Reputation: 913
Hi I just followed the thoughtbot laptop setup for my Mac Mini Server running OSX Lion Server. I'm not sure that everything is installed correctly. Please advise.
I don't have a ~/.bash_profile
or ~/.bashrc
but i do have a ~/.profile
But here are contents for .zshrc
since I use .zsh
.
1 # load our own completion functions
2 fpath=(~/.zsh/completion $fpath)
3
4 # completion
5 autoload -U compinit
6 compinit
7
8 # automatically enter directories without cd
9 setopt auto_cd
10
11 # use vim as an editor
12 export EDITOR=vim
13
14 # aliases
15 if [ -e "$HOME/.aliases" ]; then
16 source "$HOME/.aliases"
17 fi
18
19 # vi mode
20 bindkey -v
21 bindkey "^F" vi-cmd-mode
22 bindkey jj vi-cmd-mode
23
24 # use incremental search
25 bindkey "^R" history-incremental-search-backward
26
27 # add some readline keys back
28 bindkey "^A" beginning-of-line
29 bindkey "^E" end-of-line
30
31 # handy keybindings
32 bindkey "^P" history-search-backward
33 bindkey "^Y" accept-and-hold
34 bindkey "^N" insert-last-word
35 bindkey -s "^T" "^[Isudo ^[A" # "t" for "toughguy"
36
37 # expand functions in the prompt
38 setopt prompt_subst
39
40 # prompt
41 export PS1='[${SSH_CONNECTION+"%n@%m:"}%~] '
42
43 # ignore duplicate history entries
44 setopt histignoredups
45
46 # keep TONS of history
47 export HISTSIZE=4096
48
49 # look for ey config in project dirs
50 export EYRC=./.eyrc
51
52 # automatically pushd
53 setopt auto_pushd
54 export dirstacksize=5
55
56 # awesome cd movements from zshkit
57 setopt AUTOCD
58 setopt AUTOPUSHD PUSHDMINUS PUSHDSILENT PUSHDTOHOME
59 setopt cdablevars
60
61 # Try to correct command line spelling
62 setopt CORRECT CORRECT_ALL
63
64 # Enable extended globbing
65 setopt EXTENDED_GLOB
66
67 # RVM
68 [[ -s '/Users/pma/.rvm/scripts/rvm' ]] && source '/Users/pma/.rvm/scripts/rvm'
Brew complains with brew doctor
[~] brew doctor
/usr/bin is in your PATH before Homebrew's bin. This means that system-
provided programs will be used before Homebrew-provided ones. This is an
issue if you install, for instance, Python.
Consider editing your .bashrc to put:
/usr/local/bin
ahead of /usr/bin in your $PATH.
zsh:
[~] zsh --version
zsh --version
zsh 4.3.11 (i386-apple-darwin11.0)
So how can I ensure brew is installed correctly and remove the errors from brew doctor?
Upvotes: 89
Views: 209414
Reputation: 6863
On macOS Sonoma, after installing brew, it told me what I needed to do:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/johndoe/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Partially-full output:
...
Unpacking objects: 100% (33/33), 5.60 KiB | 163.00 KiB/s, done.
From https://github.com/Homebrew/brew
* [new tag] 4.0.29 -> 4.0.29
* [new tag] 4.1.9 -> 4.1.9
* [new tag] 4.2.14 -> 4.2.14
Switched to a new branch 'stable'
==> Updating Homebrew...
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:49847c7a13f7094b211f6d0025900dd23716be07dac894a3d6941d7696296306
################################################################################################################################################# 100.0%
==> Pouring portable-ruby-3.3.3.arm64_big_sur.bottle.tar.gz
Warning: /opt/homebrew/bin is not in your PATH.
Instructions on how to configure your shell for Homebrew
can be found in the 'Next steps' section below.
==> Installation successful!
...
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/johndoe/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
...
Upvotes: 1
Reputation: 1
Imac 2021 M1 Sonoma 14.4.1:
export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc
Working for me!
Upvotes: 0
Reputation: 21
For permanent fix just execute the below command:
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
Upvotes: 2
Reputation: 1328
For some reason none of the solutions here worked for me until I had to put both of the following two lines into my .zshrc file
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
export PATH="/home/linuxbrew/.linuxbrew/sbin:$PATH"
Then restart your zsh shell and it should work.
Upvotes: 1
Reputation: 382
After installing Homebrew by the below command
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Run
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/atubasi/.zprofile
Then run
eval "$(/opt/homebrew/bin/brew shellenv)"
This will evaluate if your setup for Homebrew is working fine or not. You can run brew help
to ensure that brew is defined in your zsh profile.
Upvotes: 5
Reputation: 1738
Following @Sajjad's answer did help but I had to run that command every time I started a new terminal which was
export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc
I don't know much unix but what's going on here I believe is that we are appening
export PATH="/opt/homebrew/bin:$PATH"
part to our .zshrc
file which at the root of our file structure at the end of the file.
So, I ran
nano ~/.zshrc
and added
export PATH="/opt/homebrew/bin:$PATH"
at the end and it worked for all terminals from then on.
I am on the M1 if that is relevant
Upvotes: 10
Reputation: 2607
This worked for me on macOS ARM (Apple M1):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
and then:
export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc
Upvotes: 160
Reputation: 1278
Not sure if this is late but you can simply run this to add Homebrew to your PATH
:
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
Upvotes: 25
Reputation: 778
Open the ~/.zshrc file first line in file says
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
just comment out second line it will start working :)
Upvotes: 8
Reputation: 680
I use ohmyzsh. Go to the directory
cd /usr/local/bin
brew doctor
You will notice it shows warnings like:
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
autoconf
automake
gdbm
gnupg
libgpg-error
libksba
libtool
libyaml
mongodb
node
pcre
pkg-config
zsh
You will have to run a command here:
brew link zsh
And that link it for me.
Upvotes: 11
Reputation: 812
This worked for me:
export PATH="/usr/local/bin:$PATH" >> ~/.zshrc
Upvotes: 26
Reputation: 9752
Try setting this line in your .zshrc
export PATH=/usr/local/bin:$PATH
Upvotes: 86