Skip to main content

macusers

Get details on macOS user accounts.

>>> import macusers
# get the logged in user details.
>>> user = macusers.primary()
# get the logged in user's username.
>>> user.username
'bryanheinz'
# get logged in user's home folder as a `pathlib` object.
>>> user.home
PosixPath('/Users/bryanh')
# get a list of non-system user accounts.
>>> for user in macusers.users(False): print(user.username)
bryanheinz
morrismoss
# get a list of admin accounts.
>>> for admin in macusers.admins(False): print(admin.username)
bryanheinz
# check if the user has FileVault access. NOTE: requires admin.
>>> macusers.primary().fv_access()
True
# check if the user is an APFS volume owner.
>>> macusers.primary().apfs_owner()
True
# check if the user has a secure token.
>>> macusers.primary().secure_token_status()
True

This module is used to get the current or last (if the system currently doesn't have any logged in users) logged in console user on macOS instead of the user running the script/program.

This module now contains the following User properties:

  • username : The user's username
  • real_name : Full name
  • uid : The user's ID
  • gid : Primary group ID
  • guid : Generated user ID - used by APFS
  • home : Home folder
  • shell : Default shell
  • admin : If the user is an admin
  • ssh_access : If the user has SSH access
  • volume_owner : If the user is an APFS volume owner
  • secure_token : If the user has a secure token
  • created : Epoch time when the user was created
  • password_updated: Epoch time when the user's password was last changed

These properties can be accessed via User.PROPERTY e.g. macusers.primary().admin.

Installing

You can install macusers using pip. macusers has been tested with Python 3.7 and 3.9.

python3 -m pip install macusers

Release files for macusers 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for macusers 1.0.0
File Size Uploaded
macusers-1.0.0.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for macusers 1.0.0
File Interpreter ABI Platform
macusers-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / macusers-1.0.0.tar.gz

Download URL macusers-1.0.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
be9c5572d1004eec2b53c3b6cfd8255c96dd265935a6293fa7535c61cb43deba
BLAKE2b-256 checksum
How to use checksums
80ceb11a05d40cf7dcf208f59b06d7fcde89cee86d84ab09e9db38fada453d1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.11

Release files / macusers-1.0.0-py3-none-any.whl

Download URL macusers-1.0.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e7bcaf064ff3077796dc11ca6aa22cdb41c28a201fe1d9f27febee8ad27b5d5
BLAKE2b-256 checksum
How to use checksums
f9fd0353fa823a3482c9c36732f8079f85b2e00d1a888f8ad98a6926bf56b34a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page