I was following a tutorial on updating my Mac to PHP 5.4. Things were going well until I had to step away. Now I don't remember where I left off and couldn't find the same tutorial any more. I did get as far as creating the my_phpinfo.php file, but when I brought it up, it showed 5.3.
I end up digging and digging, then turning to Homebrew. I installed Homebrew and had the standard
Consider amending your PATH so that /usr/local/bin is ahead of /usr/bin in your PATH
I followed this and it didn't work. I found the wiki for Homebrew uninstall and think I'm in worse shape. After trying to reinstall, I get
-bash: curl: command not found
-bash: ruby: command not found
I decided to try to restart Apache
-bash: sudo: command not found
Now I'm stuck. Can anyone help?
You seem to have erased your /etc/paths file. Your path specifies places to look for programs so that you don't have to type the full path every time you wish to use them. NOTE: typing /bin/bash and /bin/ls should work for you...
I suggest you open the /etc/paths file in a text editor and check that it looks like this:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/local/sbin
To do this from the command line you would need to type:
/usr/bin/nano /etc/paths
If you prefer to use vim then exchange nano for vim and if you need elevated permissions then prefix the command with "/usr/bin/sudo".
After you've done this close and reopen the terminal and you should find the terminal working normally again.
If this doesn't work, your path will most likely be being set in one or many of: /etc/profile, ~/.bash_profile, ~/.bash_login or ~/.profile. Check these files exist and if they do, check for mentions of PATH in them and ensure it is getting set with the correct values.
Related
I have a new Macbook M1 and usually edit files and write short scripts with nano. However, I am stuck in default settings, which are of course not really feasible. I created a file ~/.nanorc and since it didn't work also a file ~/etc/nanorc with the following content:
set linenumbers
set tabsize 4
set tabstospaces
unset mouse
Unfortunately, it has no effect. I don't remember, if I faced the same problem when customising nano at my old macbook. Can someone help me out here?
Thanks!!
I was having the same issue after I installed nano using brew (Monterey on M1). It turned out that nano command is by default symlinked to pico editor in /usr/bin, see https://ss64.com/osx/pico.html.
You can try checking if that is the case for you by using which nano. In my case it was pointing to /usr/bin/nano which is actually just symlink to pico (you can check this with readlink /usr/bin/nano)
This is probably an issue with homebrew, check this post Homebrew: Could not symlink, /usr/local/bin is not writable
As a quick fix (to verify if this is actually the case) you can just create a symlink pointing to homebrew installation of nano: ln -s /opt/homebrew/bin/nano /usr/local/bin/nano.
This should open nano instead of pico when using nano command and settings in .nanorc should now also be taken into account.
Yesterday I was using all my installed packages without any problem such as mysql, composer, php, brew and co...
However, today I started my MacBook and typed mysql and I got: zsh: command not found: mysql. Not even brew is working anymore and I don't know why.. this is my .zshrc config file and I don't know why it isn't working.
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:~/.composer/vendor/bin:$PATH
Any ideas how to fix this?
Yuck, how did that happen? Try this:
PATH=/bin:/usr/bin:/usr/local/bin:$PATH
export PATH
Whether this works is going to depend on where you have been installing user executables. If you're using homebrew, I would expect it to be /usr/local/bin but perhaps it is something different in your case? You might want to try putting /usr/local/bin first so things installed by homebrew get picked up before the defaults in /usr/bin and /bin (this is what I do, and I'm still alive to talk about it...)
You could also change your default shell back to Bash:
brew install bash
echo '/usr/local/bin/bash' >> /etc/shells
chsh
You might need to use sudo on line 2.
I installed vim via brew so I could have the latest version (7.4) and get syntax highlighting for Clojure. No big deal. Unfortunately, the brew version of vim seems to be broken on my system. I also aliased the vim command:
brew install vim # Install went successfully
alias vim=/usr/local/Cellar/7.4.052/bin/vim # Shouldn't be any problems here
When I open the brew version of vim, it fails to load any of my plugins (I use spf13) throwing a bunch of "Undefined variable" and "Invalid expression", etc errors for every plugin in my bundle directory; I just hit enter to continue. My .vimrc loads properly. When I open a file, it opens two tabs, both blank. One is a new file, the other is the file I tried to open, except there's nothing in it.
Potentially useful information: echo $VIM returns an empty line, while echo $ZSH returns /User/bsima/.dotfiles as expected.
Here are my dotfiles, but I don't think the problem lies in those configuration files.
Is this a known bug? Or is something wrong with my vim install?
I have no idea what's going on and I really miss my vim :( As good as Textmate is, I can't be without vim forever.
Edit: MacVim, installed via Homebrew, kinda works. It still opens 2 tabs on startup, but it does open files for editing and saves.
I found the problem: it was with my spf13 vim config. The following commands fixed the issue, in addition to double-checking that symlinks such as ~/.vim and ~/.vimrc were correct:
> which vim # This should output /usr/local/bin/vim since I'm using Homebrew
/usr/local/bin/vim
> cd ~/.spf13-vim-3
> ./bootstrap.sh # Basically re-installs spf13
So I just installed emacs version 24 on OS X 10.8 by means of brew package manager, it installed in /usr/local/Cellar/emacs. I regularly use the builtin version of emacs version 22, but its in /usr/bin.
So there are two things I'd like to know how to do
Change it so that the first place that bash looks for is in
/usr/local/Cellar and their bins
Just change it so that the bin for emacs in /usr/bin calls the bin for
emacs in /usr/local/Cellar/emacs/bin.
These are two separate but related questions.
EDIT: So I did a hack job and just edited the .bash_profile and did an export for /usr/local/Cellar/emacs/24.3/bin ..but still would like to know how to get one bin to call another one.
It's probably better to not touch anything in /{usr/,}{s,}bin. You can use homebrew versions in bash by adding something like this to .bash_profile:
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
Putting /usr/local/bin and /usr/local/sbin first in /etc/launchd.conf might have some unexpected side-effects. For example in TextMate many commands stop working if env ruby is Ruby 2.0 or 1.9.
Or for example set PATH to ~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin and add symlinks to ~/bin/. See this answer.
I have home brew installed and rbenv. I've followed these instructions:
http://octopress.org/docs/setup/rbenv/
Everything seems to work flawlessly but when I type
ruby -v
it still says 1.8.7...
Not sure what I'm doing wrong.
Unix will run the copy of Ruby that it finds first in your search path. Type these commands in Terminal:
echo $PATH
which ruby
The first will show you the order in which Unix is looking for the ruby command. The second will tell you which ruby it's finding. You may need to edit the PATH= command in your .bash_profile or .bashrc to change the order of the search path, e.g.:
PATH=/usr/local/bin:/usr/local/sbin:$PATH
prepends /usr/local/bin and /usr/local/sbin to your existing PATH to tell Unix to search your /usr/local/bin directory before /usr/bin
I have tried MacPorts and Homebrew many times the last couple of years. When it comes to ruby no other system can match RVM.
There are numerous guides online. Google, pick one and go.
NOTE: Octopress bloging system, comes with an rvm-ready bundle which will install and use ruby-1.9.2x, last time I checked :-)