I’m trying to get Cider to work on my laptop running OSX and failing. This makes me unhappy because I managed to do it on a Windows machine with lots of Cygwin so I felt that getting it to work on a Mac should be a breeze.
Basically, what I have set up my little project using `lein` and can run it from the command line and from eshell, and I use Clojure Mode, but when I run `M-x cider-jack-in` I see is this in my `*Messages*` buffer:
Starting nREPL server via /Users/alex/bin/lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.12\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.15.0-SNAPSHOT\"\] -- repl :headless... Mark set nREPL server started on 53929 [nREPL] Establishing direct connection to localhost:53929 ... error in process filter: nrepl--direct-connect: [nREPL] Direct connection failed error in process filter: [nREPL] Direct connection failed
But now I have three buffers named `*nrepl-server ...` with contents such as `nREPL server started on port 53872 on host 127.0.0.1 - nrepl://127.0.0.1:53872`.
This reminds me... My Mac keeps deleting my `/etc/hosts` file which means that `localhost` is borked:
$ ping localhost ping: cannot resolve localhost: Unknown host
So I added it back to `/etc/hosts`.
127.0.0.1 localhost
Then I killed the three nrepl-server buffers and tried `C-c M-j` again.
And it works. Phew!
Sometimes writing these posts just helps me focus as I’m troubleshooting.
#Clojure #Emacs
(Please contact me if you want to remove your comment.)
⁂
Your mac deleting _etc_hosts file sounds really bad
– nickf 2016-12-08 22:53 UTC
---
Yeah. I think it rewrites the file whenever the system updates? So any code that depends on localhost mapping to 127.0.0.1 usually breaks after an update. Gah!
– Alex Schroeder 2016-12-08 22:59 UTC
---
Hi Alex, that deletion of _etc_hosts sounds vary odd. I use emacs, cider, lein etc almost daily on OSX and have not run itno that issue ever. I do use hombrew for emacs and lein. I am now running macOSSierra, but have been doing clojure et. al. on a Macbook for the past few years and used the last2 or 3 OSX versions.
– Tim X 2016-12-09 08:30 UTC
---
Strange. I also have OpenVPN installed on the Mac and it puts stuff into the file. Googling for the problem shows that some versions of a Cisco VPN used to do the same. I should just deinstall it and see whether that resolves it.
– AlexSchroeder 2016-12-09 11:47 UTC