149
votes
Why does my brew installation not work?
I had the same problem—installed brew, used it, but now it doens't work, ie, brew command not recognized anymore.
The context of my brew-not-recognized-anymore problem is a bit more specific: I'm ...
- 1,599
86
votes
Why does my brew installation not work?
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
This code works for me on a MacBook Pro M1.
- 969
28
votes
Accepted
I broke my PATH by editing my ~/.bash_profile and Bash will not recognize most commands
The simplest way is to restore from a backup e.g from Time Machine
However if the last backup is long enough ago that there is other changes you want to keep the you can edit .bash_profile
In ...
- 28.7k
25
votes
How to set PATH for Finder-launched applications
On OS X 10.10 Yosemite, I used this command:
sudo launchctl config user path <my path setting>
Be aware that his sets the launchtl PATH for all users. This worked well for my use case. Note ...
- 351
19
votes
Accepted
What are the downsides of putting GNU coreutills first in ${PATH}?
It will break any script which expects BSD-style utilities (different arguments, partially different functionality)
But you can install coreutils with Homebrew or Macports which will give them a g ...
- 92.6k
16
votes
Where is my .bash_profile located? (Mac OS 10.10.5)
Navigate to your user folder in Finder: /Users/username/
Make hidden files visible (the shortcut is ShiftCmd.)
Right click .bash_profile and Open With... your text editor of choice.
ShiftCmd. one ...
- 1,027
16
votes
Accepted
Problem with displaying file path in Finder's Get Info -> Where
You can select the file and press Option + Command + C to copy the pathname to the clipboard.
https://apple.stackexchange.com/a/252179/192890
You can also use Control + Option + right click in macOS ...
- 2,291
16
votes
What are the downsides of putting GNU coreutills first in ${PATH}?
While using un-prefixed coreutils has the potential to break any script expecting BSD-style programs, I have been using un-prefixed coreutils for almost 8 years now, and I've never run into a single ...
- 277
14
votes
Why does my brew installation not work?
If your shell is zsh and your Mac is M1-based, enter these two commands after installing brew:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/...
- 141
14
votes
Why does my brew installation not work?
the -bash: brew: command not found error means that it didn't find the brew environment variable on your Mac.
The correct environment configuration in .bash_profile file should be like this:
export ...
- 157
14
votes
I broke my PATH by editing my ~/.bash_profile and Bash will not recognize most commands
Bring back a minimal PATH
Enter the following command to reset a minimal PATH:
PATH=/bin:/usr/bin
Fix ~/.bash_profile
Edit your ~/.bash_profile with your preffered text editor vi, emacs
or ...
- 11.6k
14
votes
Accepted
What is the Default content in /private/etc/paths?
The default content of /etc/paths until Mavericks (10.9) is:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
The default content of /etc/paths since Yosemite (10.10) is:
/usr/local/bin
/usr/bin
/bin
/...
- 65k
14
votes
Accepted
I downloaded a shell executable and man pages from a source I trust. Where should I put them?
The binary file goes in /usr/local/bin. Each man page goes in the folder usr/local/share/man/manN where N is the number at the end of the man page file name. For example, gdisk.8 should appear in the ...
- 36k
13
votes
Accepted
How to get an application executable path from Terminal
I would like to know if there is a command that returns the executable within the application bundle
There is no such command, but I've written a shell script that does exactly that for any ...
- 14.5k
12
votes
Problem with displaying file path in Finder's Get Info -> Where
Right Click on Folder/File
Hold down the Option key
Select Copy "[filename]" as pathname
Paste to wherever you need it
12
votes
Accepted
"which" command doesn't work / path of Safari?
which searches for binaries in the $PATH, a.k.a. command-line tools. User applications are not such tools and not available in the command line.
While Safari.app is an application, the Safari binary ...
grg♦
- 193k
12
votes
Accepted
Homebrew PATH set in .zshenv is overridden
After ~/.zshenv is sourced, the next file that is loaded is /etc/zprofile, which is provided by macOS. This script executes
eval `/usr/libexec/path_helper -s`
The manual for path_helper explains:
...
- 427
11
votes
Accepted
Where is my .bash_profile located? (Mac OS 10.10.5)
You can edit bash profile with vi ~/.bash_profile make sure the PATH was not added in ~/.bashrc or to /etc/profile
To remove the PATH you can either remove it from the file where it was added, or ...
- 376
10
votes
Open Finder window from current Terminal location?
Stretch goal!
To expand on the answer above (because the more appropriate related question is marked as a dupe and can't receive new answers)...
I've added a function to my ~/.bash_profile to handle ...
- 1,043
10
votes
Accepted
Get AppleScript Path of Parent Folder
AppleScript is written in English. Read what it says! Remove the posix path of from the code, and you'll get the HFS path.
Full code:
tell application "Finder" to get (container of (path to me)) as ...
- 5,419
10
votes
Accepted
How to know where file is going to be saved?
Click on position indicated by the red arrow in the figure below:
This will allow you to choose which folder/path you need. You can also use the Command - Shift - G to open the dialog to ...
- 1,229
10
votes
Accepted
Saving a filename with a special character in Mac?
Unicode U+002F is equivalent to ASCII 47, or the "slash"/soldus key on your keyboard. Calling it a Unicode special character
is a bit like maître Pathelin in the medieval farce discovering ...
- 34k
9
votes
Accepted
How to deal with whitespaces in OS X along filepaths when certain UNIX programs dislike it
In bash, there are two main ways to have spaces in path names:
Backslash escape the spaces
/path/to/folder\ with\ spaces/
Wrap with quote marks
"/path/to/folder with spaces and $variable/"
'/path/...
grg♦
- 193k
9
votes
How do I change the location of macOS screen captures?
As of macOS 10.14+, you don't need any specific software or scripts. The default screenshot location can be changed in the Screenshot app UI:
Enter Screenshot mode:
Press Command+Shift+5
Press the ...
- 274
9
votes
Accepted
Set PATH variable so that it is detected in all applications, even outside terminal. (El Captain)
The loginwindow process sets a user's environment. It sets the variables TMPDIR and PATH, consults Directory Services and sets SHELL HOME USER LOGNAME . PATH is set to /usr/bin:/bin:/usr/sbin:/sbin ...
- 9,908
8
votes
Get AppleScript Path of Parent Folder
Try this:
Unix style:
set my_POSIX_path to POSIX path of ((path to me as text) & "::")
If you need to pass it to e.g. shell script, you might want to enclose the path with quotes:
set ...
- 273
8
votes
Accepted
$PATH vs. $path
The error mentioning ‘type’ refers to the data type of the variable, such as string or array.
$PATH is a string, $path is an array. You cannot assign a string, whether by variable or by literal, to a ...
grg♦
- 193k
7
votes
OS X: common paths for executable files
/usr/local/bin is a suitable path for non-GUI applications. For example, you might put rsync 3.0 in there as compiled 'rsync3'.
This folder is listed in $PATH by default.
- 181
7
votes
Accepted
7
votes
Accepted
ERROR: AUCTeX cannot find a working TeX distribution (macOS Sierra)
As patrix suggested, the problem was that the PATH variable that the error message referred to was not the Terminal's environment variable but emacs' own environment variable, whose content can be ...
- 853
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
path × 319macos × 134
terminal × 123
bash × 81
command-line × 53
homebrew × 35
finder × 34
zsh × 21
python × 19
applescript × 18
environment-variables × 13
automator × 9
macbook-pro × 8
applications × 8
mac × 7
file × 7
install × 6
launchd × 6
mojave × 5
unix × 5
script × 5
iterm × 5
symlink × 5
git × 5
catalina × 4