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.
I'm trying to enable copying to OSX's clipboard in vim and most resources I have found say that I need a version of vim with +clipboard. These resources also indicate that this should be as easy as running brew install vim, however, I am stuck with -clipboard even after updating. Any suggestions as to how to force this feature? Do I even need it to achieve the desired behavior?
a brew update brew install vim should give you vim with +clipboard.
However your path probably still points to the old vim. Try that:
alias vim="/usr/local/bin/vim"
probably this will also work: (Not anymore, see the Update)
brew install vim --with-override-system-vim
Addition: I recommend to install it with brew install vim --with-client-server so you will have +xterm_clipboard.
Alternativly you could install macvim which should have all these features already in:
brew install macvim --with-override-system-vim
Update
--with-override-system-vim was removed. The best solution in my opinion is to just add macvim in front of your PATH:
PATH="/Users/user/Applications/MacVim.app/Contents/MacOS/Vim:${PATH}"
export PATH
You can test if vim points to the right instance with which vim
After updating to mac os x sierra my cvs (yes I am still using cvs) repository is no longer accessible from remote computer. I can still access the cvs commands on local machine using terminal window, using:
CVSROOT=/usr/local/cvsrep
although if I define the cvs variables with
export CVS_RSH=ssh
export CVSROOT=:ext:twarren#tw-imac.local/usr/local/cvsrep
it also does not work, giving error message:
tw-imac:testcvs twarren$ cvs version
Client: Concurrent Versions System (CVS) 1.12.13 (client/server)
Password:
bash: cvs: command not found
The cvs program is installed in /usr/local/bin (which is on the PATH). It is the old version of cvs that used to come with mac os x and has worked fine with newer versions of mac os x until sierra.
I've just faced this same issue.
ie, remote cvs checkouts don't work.
ie, cvs -z3 -d:ext:<user>#<cvs-server-ip>:<CVSROOT> co -P -r <REVISION> <MODULE> results in cvs: bad command
There are three problems,
cvs was removed back in 10.9
cvs over ssh relies on the sshd PATH support, which is hard-coded
/usr/bin is rootless, ie read-only.
You solve the first problem by installing cvs with homebrew
Install homebrew see: https://brew.sh
then brew install cvs
The next problem, is that when you try to run cvs:ext, you find the PATH is not right, this can be tested like so:
ssh <user>#cvs-sever-ip env | grep PATH
You will see, PATH=/usr/bin:/bin:/usr/sbin:/sbin, which is the sshd non-interactive hard-coded path. For non-interactive ssh, as used by CVS to access the homebrew cvs install (installed into `/usr/local/bin/cvs) you need to add /usr/local/bin to the sshd path. AFAICT this can't be done... non-trivially... as such, the best solution is to make a sybolic link in the /usr/bin directory.
sudo ln -s /usr/local/bin/cvs /usr/bin/cvs
Which leads to the third problem. It doesn't work, because /usr/bin is rootless... and thus read-only.
You could disable rootless mode in recovery mode... and then do it, and then re-enable it.
But the simplest solution is to reboot into Recovery mode, enter the terminal, then cd /Volumes, then navigate to the the /usr/bin directory on your boot volume, ie cd /Volumes/<bootvolume>/usr/bin
then run the command:
ln -s /usr/local/bin/cvs cvs
This will create a symbolic link from /usr/bin/cvs -> /usr/local/bin/cvs
Reboot back to your OS, and that should fix it.
You can verify this with
ssh <user>#<cvs-server-ip> which cvs
which should return :
/usr/bin/cvs
And now your remote cvs checkouts should work...
so I found a way to get cvs to work on sierra. The problem seemed to be that the /usr/local/bin directory was no longer on the path of the shell started by ssh. So the solution consisted of copying the cvs executable to /usr/bin
However, in order to accomplish this on Sierra I had to temporarily disable SIP. This was done by:
reboot with recovery mode
run terminal utility
execute: csrutil disable
reboot
Then I could copy the cvs program. After verifying that it worked properly, I repeated the steps 1-4, except using: csrutil enable in step 3.
NOTE: there will probably be cases where updates to Sierra might replace /usr/bin contents, so it's possible that this process will need to be repeated after updates. To aid in this, I copied the cvs module rather than moving it, so it will still be available in its old location.
NOTE 2: I agree with those who recommend using git rather than cvs and will do that with all new projects. In addition I will eventually also convert existing projects to git where feasible, but am glad that I can still use cvs as before Sierra.
I installed macport following the guide.
http://afitnerd.com/2011/09/06/headless-browser-testing-on-mac/
However, when I try to run
sudo port upgrade
it has error message
Can't map the URL 'file://.' to a port description file ("Could not
find Portfile in /Users").
Please verify that the directory and portfile syntax are correct.
To use the current port, you must be in a port's directory.
How should I switch to the right directory?
sudo port upgrade tells MacPorts to upgrade the port defined by the Portfile in the current directory. It's usually a command only developers use while writing Portfiles. The guide likely meant sudo port upgrade outdated instead to upgrade all non-current ports. Since you don't have any ports installed if this is your first MacPorts installation, you can safely skip the command.
Note that firefox-x11 has meanwhile been removed from MacPorts because it was broken, outdated, and nobody stepped up to maintain it.
I have MacVim installed and I am trying to set it up as the editor for Git (version control), but I can't run 'mvim' from the command line as it isn't recognised. How do I setup mvim so I can run it from Terminal?
I don't think I'd to add anything to the path, did
brew install macvim
mvim -v
should then open macvim in the terminal, you can also go ahead and alias that
alias vim='mvim -v'
There should be a script named mvim in the root of the .bz2 file. Copy this somewhere into your $PATH ( /usr/local/bin would be good ) and you should be sorted.
If you go the brew route, the best way to install would be:
brew install macvim --with-override-system-vim
That will provide mvim, vim, vi, view, etc. in /usr/local/bin (all symlinked to the copy in the Cellar). This also removes the need to create any aliases and also changes your vi, vim, etc. to all use the same Vim distribution as your MacVim.
In addition, if you want to use MacVim (or GVim) as $VISUAL or $EDITOR, you should be aware that by default MacVim will fork a new process from the parent, resulting in the MacVim return value not reaching the parent process. This may confuse other applications, but Git seems to check the status of a temporary commit message file, which bypasses this limitation. In general, it is a good practice to export VISUAL='mvim -f' to ensure MacVim will not fork a new process when called, which should give you what you want when using it with your shell environment.
If you already have macVim installed: /Applications/MacVim.app/Contents/MacOS/Vim -g will give you macVim GUI.
just add an alias.
i use gvim because that is what i use on linux for gnome-vim.
alias gvim='/Applications/MacVim.app/Contents/MacOS/Vim -g'
Assume MacVim is installed in the Application folder.
Instead of adding MacVim path to your environment, create a link by typing this in terminal:
sudo ln -s /Applications/MacVim.app/Contents/bin/mvim /usr/local/bin/mvim
Then, open a new terminal window/tab and type mvim.
If you have homeBrew installed, this is all you have to do:
brew install macvim
brew linkapps
Then type mvim in your terminal to run MacVim.
Here's what I did:
After building Macvim I copied mvim to one of my $PATH destinations (In this case I chose /usr/local/bin)
cp -v [MacVim_source_folder]/src/MacVim/mvim /usr/local/bin
Then when you invoke mvim it is now recognised but there is an annoying thing. It opens the visual MacVim window, not the one in terminal. To do that, you have to invoke
mvim -v
To make sure every time you call mvim you don't have to remember to add the '-v' you can create an alias:
alias mvim='mvim -v'
However, this alias will only persist for this session of the Terminal. To have this alias executed every time you open a Terminal window, you have to include it in your .profile
The .profile should be in your home directory. If it's not, create it.
cd ~
mvim -v .profile
include the alias command in there and save it.
That's it.
I'm adding Bard Park's comment here for that was the real answer for me:
Since mvim is simply a shell script, you can download it directly from the MacVim source at GitHub here: http://raw.github.com/b4winckler/macvim/master/src/MacVim/mvim
I'd seriously recommend installing MacVim via MacPorts (sudo port install MacVim).
When installed, MacPorts automatically updates your profile to include /opt/local/bin in your path, and so when mvim is installed as /opt/local/bin/mvim during the install of MacVim you'll find it ready to use straight away.
When you install the MacVim port the MacVim.app bundle is installed in /Applications/MacPorts for you too.
A good thing about going the MacPorts route is that you'll also be able to install git too (sudo port install git-core) and many many other ports. Highly recommended.
This works for me:
λ brew link --overwrite macvim
Linking /usr/local/Cellar/macvim/8.0-146_1... 12 symlinks created
For Mac .app bundles, you should install them via cask, if available, as using symlinks can cause issues. You may even get the following warning if you brew linkapps:
Unfortunately brew linkapps cannot behave nicely with e.g. Spotlight using
either aliases or symlinks and Homebrew formulae do not build "proper" .app
bundles that can be relocated. Instead, please consider using brew cask and
migrate formulae using .apps to casks.
For MacVim, you can install with:
brew cask install macvim
You should then be able to launch MacVim like you do any other macOS app, including mvim or open -a MacVim from a terminal session.
UPDATE: A bit of clarification about brew and brew cask. In a nutshell, brew handles software at the unix level, whereas brew cask extends the functionality of brew into the macOS domain for additional functionality such as handling the location of macOS app bundles. Remember that brew is also implemented on Linux so it makes sense to have this division. There are other resources that explain the difference in more detail, such as What is the difference between brew and brew cask?
so I won't say much more here.