1

I tried installing nano using "port install nano", but using the "nano" command doesn't open the macports version.

$ which nano
/opt/local/bin/nano

$ /opt/local/bin/nano --version
GNU nano version 2.2.6 (compiled 13:17:29, Nov 26 2013)
(C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009 Free Software Foundation, Inc.
Email: nano@nano-editor.org Web: http://www.nano-editor.org/
Compiled options: --disable-wrapping-as-root --enable-color --enable-extra --enable-multibuffer --enable-nanorc --enable-utf8

$ nano --version
GNU nano version 2.0.6 (compiled 18:58:13, Aug 24 2013)
Email: nano@nano-editor.org Web: http://www.nano-editor.org/
Compiled options: --disable-nls --enable-color --enable-extra --enable-multibuffer --enable-nanorc --enable-utf8

$ echo $PATH
/Users/zach.alnasser/golang//bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

I want to use the nano in /opt/local/bin, but even though that directory is at the beginning of my $PATH, the native nano continues to open. Even if I rename /usr/bin/nano, it complains that /usr/bin/nano doesn't exist, instead of using the macport version.

0

You can either rename or completely remove /usr/bin/nano, then:

ln -s /opt/local/bin/nano /usr/bin/nano

The above command creates a symbolic link from /usr/bin/nano to /opt/local/bin/nano

  • A symbolic link! Of course! Why didn't I think of that :). Thanks for your help! – zymhan Jun 2 '14 at 20:15
  • Please don't modify /usr/bin. That's Apple-land, and other stuff must be able to rely on the versions of software installed there. In your case, typing hash -r into your shell or opening a new one would probably have made MacPorts' nano the default (the old one was used because of a cache in your shell). The symlink isn't necessary. – neverpanic Aug 15 '14 at 23:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .