Skip to content

default-browser assumes home directory is /Users/<username>, which fails for relocated macOS home directories #23

Description

@jimratliff

Hi — thanks for maintaining this tool.

I ran into an issue on a Mac where the current user’s home directory is not under /Users. The account is configured normally in Directory Services:

id -un
# oliver

echo "$HOME"
# /Volumes/some_personal_volume/Users/oliver

dscl . -read /Users/oliver NFSHomeDirectory
# NFSHomeDirectory: /Volumes/some_personal_volume/Users/oliver

But running:
default-browser --identifier net.waterfox.waterfox
fails with: "Error: mkdir /Users/oliver: permission denied"

From a quick look, it appears that default-browser constructs the LaunchServices plist path using /Users/<username>/Library/... rather than resolving the current user’s actual home directory.

Would you consider using the user’s real home directory, for example via os/user.Current().HomeDir or similar, instead of assuming /Users/<username>?

This would make the tool work for macOS accounts whose NFSHomeDirectory points to another volume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions