'Mac OS make scripts available globally

I have a bunch of scripts that I want available whereever I am so I don't have to directly target the file. Similar to things like docker but how do I do this on a mac?

I have added a folder called juicy to /usr/local/bin and it now looks like:

enter image description here

The permissions to the folder looks like: enter image description here

When I attempt to run a shell script from within the juicy folder I can get a permission denied error.

zsh: permission denied: juicy

Does the folder need to be running under root?

UPDATE Managed to get this working by moving the files to /Users/username/bin and I can now (from anywhere) run the script however I need to add the script to the route of the bin folder.

  • /Users/username/bin/foobar.sh << works
  • /Users/username/bin/juicy/foobar.sh << does not work

Is it possible to have subfolders?



Solution 1:[1]

Open your /Users/username/.bashrc or if you are using zsh your /Users/username/.zshrc and add the following:

export PATH=$HOME/bin:/usr/local/bin:/usr/local/bin/juicy:$PATH

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kenny