Skip to content

Create relative symlink#433

Open
xsYf6tdq8 wants to merge 2 commits into
pyenv:masterfrom
xsYf6tdq8:master
Open

Create relative symlink#433
xsYf6tdq8 wants to merge 2 commits into
pyenv:masterfrom
xsYf6tdq8:master

Conversation

@xsYf6tdq8

Copy link
Copy Markdown

In my use case I sometimes move around the whole pyenv directory and this absolute link breaks my setup.
I don't see many (any?) disadvantages in always creating this symlink as a relative link.

Any other opinions?

@native-api native-api left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MacOS's ln doesn't support -r.

It can still create a relative link if one provides a relative path as the link's target.

@anupddas anupddas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @xsYf6tdq8
The ln command in macOS does not have a -r (relative) flag.
To create a relative symbolic link on a Mac, you must manually provide the relative path from the target directory to the source file, rather than using an absolute path.
If there's an actual requirement of ln -r functionality, you can install the GNU version of the command-line tools using Homebrew.

Thanks

@anupddas

anupddas commented Jun 7, 2026

Copy link
Copy Markdown

To install GNU coreutils:

brew install coreutils

Use the GNU link command (prefixed with a g by default to avoid system conflicts):

gln -sr /absolute/path/to/source /absolute/path/to/link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants