Using symbolic links to add a folder to the path on macOS

0

macOS 10.12.6

Hello, I have a Golang installation on an Apple Mac and I would like to make the files in my $GOBIN folder (~/code/go/bin) searchable from anywhere.

I'm aware that I could simply add that folder to my $PATH, but in the interests of keeping my .zshrc nice and clean, I am trying to find a way of using symbolic links (ln) to achieve this.

Can anyone shed some light on this question? Thanks.

Carl

Posted 2017-07-26T13:04:01.950

Reputation: 103

Answers

0

I don't think there's another way, cleanly at least, than adding it your ~/.zshrc

I don't know .zshrc syntax, but this works in bash:

if [ -d "$GOBIN" ]; then PATH="$PATH:$GOBIN"; fi

Jeroen

Posted 2017-07-26T13:04:01.950

Reputation: 71