commands

Ulf Hamster 2 min.
cli command line cheatsheet macos R brew jupyter scala spark

Go

Install Go via brew

Call in your sudoer account

brew install go
brew install zmq  # required for gophernotes

Set GOPATH in your user account's profile

Open in CLI

nano ~/.bash_profile

add this line and save

export GOPATH=$HOME/go

Reload profile

source ~/.bash_profile

Install gophernotes

Call in your user account

go get -u github.com/gopherdata/gophernotes
SOURCE=${GOPATH}/src/github.com/gopherdata/gophernotes/kernel
TARGET=${HOME}/Library/Jupyter/kernels/gophernotes
#TARGET=$(jupyter --data-dir)/kernels/gophernotes
mkdir -p ${TARGET}
cp ${SOURCE}/* ${TARGET}

(Check README)

Troubleshooting. If the command

gophernotes

doesn't work, then check if the absolute path works

${HOME}/go/bin/gophernotes

In the later case add the absolute path to

nano ${HOME}/Library/Jupyter/kernels/gophernotes/kernel.json

e.g. replace myusername with your's

{
    "argv": [
        "/Users/myusername/go/bin/gophernotes",
        "{connection_file}"
        ],
    ...
}

Jupyter

List all installed kernels

jupyter kernelspec list

Delete kernel

jupyter kernelspec uninstall <kernelname>

R

Install R via brew cask

Currently (2019-07-04), it's seems better to install r in MacOS as cask

brew uninstall r
brew cask install r

Set default CRAN repo

Package installation might stuck if no default source is set. Open

nano ~/.Rprofile

then add

local({r <- getOption("repos")
       r["CRAN"] <- "http://cran.r-project.org" 
       options(repos=r)
})

See stackoverflow

R Kernel

Open R terminal and execute

install.packages('IRkernel')
IRkernel::installspec()  # local installation
#IRkernel::installspec(user = FALSE)  # for system-wide usage (requires sudo)

See docs

Scala (Spark)

Install via brew

Call as sudoer

brew cask install java  # requirement
brew install scala
brew install apache-spark

Check if it works by calling the CLI IDE “spark-shell

Install toree Kernel

Call in your user account

pip install toree

Find the Spark folder with libexec

find /usr/local/Cellar/apache-spark -wholename "*libexec"

Install jupyter kernel

jupyter toree install --user --spark_home $(find /usr/local/Cellar/apache-spark -wholename "*libexec")

Links