From e27cb7d613e4c0aebc8e1d5e4a8db92d03bfcf8b Mon Sep 17 00:00:00 2001 From: Kamlesh Date: Thu, 2 Jul 2020 23:39:47 -0400 Subject: [PATCH] standardizze contributing guidelines Updated the code to use * sh code blocks for commands * console code blocks for script outputs Also updated the contributing guidelines to first run make install and then run make lint. --- .github/CONTRIBUTING.md | 4 +- .github/CONTRIBUTION_TEMPLATE.md | 2 +- Apps/Octave.md | 22 +++++++--- BashCompletion/README.md | 14 +++---- Cpp/README.md | 14 ++++--- Docker/TipsAndTricks.md | 2 - Emacs/README.md | 31 +++++++------- Git/README.md | 2 +- Git/gitignore.md | 6 +-- Go/README.md | 4 +- Heroku/README.md | 36 ++++++++++------ Homebrew/README.md | 21 +++++++--- Homebrew/Usage.md | 52 ++++++++++++++++------- Java/README.md | 20 ++++++--- Java/sdkman.md | 20 ++++----- MyySQL/README.md | 28 +++++++++---- Node.js/README.md | 50 +++++++++++++++------- Perl/README.md | 8 ++-- PostgreSQL/README.md | 40 +++++++++++++----- Python/README.md | 72 +++++++++++++++++++++----------- Python/ipython.md | 18 ++++++-- Python/numpy.md | 4 +- Python/pip.md | 26 ++++++++---- Python/virtualenv.md | 30 +++++++++---- References/README.md | 2 +- Ruby/README.md | 30 ++++++++----- Ruby/RubyGems.md | 32 ++++++++++---- Scala/README.md | 12 ++++-- SublimeText/Preferences.md | 4 +- SublimeText/README.md | 6 ++- SublimeText/SublimeLinter.md | 4 +- SystemPreferences/README.md | 18 ++++---- Vagrant/README.md | 32 ++++++++++---- Vim/README.md | 26 ++++++------ VisualStudioCode/README.md | 2 +- Xcode/README.md | 4 +- iTerm/README.md | 4 +- iTerm/ack.md | 12 +++--- iTerm/autojump.md | 6 +-- iTerm/fzf.md | 6 +-- iTerm/tree.md | 8 ++-- iTerm/zsh.md | 2 +- 42 files changed, 481 insertions(+), 255 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 98f62e87..0a0c1e7d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -7,9 +7,9 @@ Contributions to macOS Setup Guide are more than welcome. By contributing code to macOS Setup Guide, you agree to license your contribution under the [MIT License](../LICENSE). -## Linting +## Installing dependencies and linting -Run `make lint` before submitting your PR to make sure your changes comply +Run `make intall` first to make sure all the dependencies are installed in the workspace. Then run `make lint` before submitting your PR to make sure your changes comply with our styling. ## How to contribute to macOS Setup Guide diff --git a/.github/CONTRIBUTION_TEMPLATE.md b/.github/CONTRIBUTION_TEMPLATE.md index 312d2aa2..eec31ca7 100644 --- a/.github/CONTRIBUTION_TEMPLATE.md +++ b/.github/CONTRIBUTION_TEMPLATE.md @@ -13,7 +13,7 @@ diff --git a/Apps/Octave.md b/Apps/Octave.md index 22576925..eb749d56 100644 --- a/Apps/Octave.md +++ b/Apps/Octave.md @@ -15,8 +15,10 @@ As this distributes a compiled version of Octave, installation will be much fast To [install using homebrew-cask](https://octave-app.org/#installing-with-homebrew-cask) run: - brew tap octave-app/octave-app - brew cask install octave-app +```sh +brew tap octave-app/octave-app +brew cask install octave-app +``` ### Homebrew official @@ -24,15 +26,21 @@ You can also install Octave from the official Homebrew source using the method b Install `octave` from core Homebrew (which is available by default): - brew install octave +```sh +brew install octave +``` **Note**: If `brew` complains about not having a formula for Octave, the following command should fix it: - brew tap --repair +```sh +brew tap --repair +``` The command below upgrades Octave and its dependencies to the latest Homebrew-supported versions: - brew update && brew upgrade +```sh +brew update && brew upgrade +``` Octave has many dependencies which will be downloaded and installed prior to Octave. **The entire installation process can take a few hours if you are compiling from source.** @@ -40,6 +48,8 @@ Octave has many dependencies which will be downloaded and installed prior to Oct You might find that you need to add: - setenv ("GNUTERM", "X11") +```sh +setenv ("GNUTERM", "X11") +``` to your octaverc file, normally located at `/usr/local/share/octave/site/m/startup`. diff --git a/BashCompletion/README.md b/BashCompletion/README.md index 4959e834..9f50cbc9 100644 --- a/BashCompletion/README.md +++ b/BashCompletion/README.md @@ -6,7 +6,7 @@ key. This will help you when writing the bash command in terminal. ## Installation -```bash +```sh brew install bash-completion ``` @@ -14,19 +14,19 @@ Bash completion will be installed in `/usr/local/etc/bash_completion.d`. For it to work, add this to your `~/.bash_profile`: -```bash +```sh [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion ``` Or simply type: -```bash +```sh echo "[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion" >> ~/.bash_profile ``` Restart your bash session: -```bash +```sh source ~/.bash_profile ``` @@ -35,7 +35,7 @@ source ~/.bash_profile Once you've done this, you can use bash completion by pressing the tab key twice after a command. For example: -```bash +```sh $ git [tab] [tab] add blame cherry-pick config format-patch gui merge push repack rm stage whatchanged am branch citool describe fsck help mergetool range-diff replace send-email stash worktree @@ -48,13 +48,13 @@ bisect cherry commit fetch grep log You can list additional completion packages are available by typing: -```bash +```sh brew search completion ``` And you can install them using `brew install` commands, for example: -```bash +```sh brew install docker-completion ``` diff --git a/Cpp/README.md b/Cpp/README.md index 7a9000c7..aa3f4de0 100644 --- a/Cpp/README.md +++ b/Cpp/README.md @@ -2,13 +2,17 @@ Make sure you have installed [Xcode command line tools](http://sourabhbajaj.com/mac-setup/Xcode/). Check the C++ version to make sure it is Clang 4.0+. - $ c++ --version - Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) - Target: x86_64-apple-darwin13.1.0 - Thread model: posix +```console +$ c++ --version +Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) +Target: x86_64-apple-darwin13.1.0 +Thread model: posix +``` To be able to compile files from your terminal you can add the following alias in your `env.sh` file. - alias cppcompile='c++ -std=c++11 -stdlib=libc++' +```sh +alias cppcompile='c++ -std=c++11 -stdlib=libc++' +``` Then you can run all cpp file directly using `cppcompile main.cpp` and it will use C++11 so no errors in the case of using vectors, auto, sets etc. diff --git a/Docker/TipsAndTricks.md b/Docker/TipsAndTricks.md index 9ae5b8fe..d491c615 100644 --- a/Docker/TipsAndTricks.md +++ b/Docker/TipsAndTricks.md @@ -45,5 +45,3 @@ docker inspect [CONTAINER ID] | grep -wm1 IPAddress | cut -d '"' -f 4 ```sh docker kill $(docker ps -q) ``` - -Got more tips and tricks? Submit a PR! diff --git a/Emacs/README.md b/Emacs/README.md index e11c3c61..a206b255 100644 --- a/Emacs/README.md +++ b/Emacs/README.md @@ -14,26 +14,27 @@ Many useful features are built with Emacs Mac Port, e.g. environment variables, Link the Homebrew tap first. -```shell +```sh brew tap railwaycat/emacsmacport ``` * Method 1: Install with `brew cask`. - ```shell - brew cask install emacs-mac - ``` +```sh +brew cask install emacs-mac +``` There are three available versions, `emacs-mac`, `emacs-mac-official-icon`, `emacs-mac-spacemacs-icon`. * Method 2: Install using `brew`. - ```shell - brew install emacs-mac [options] - ``` +```sh +brew install emacs-mac [options] +```
-Click here to see available options: +Click here to see available options: + 1. --with-dbus, Build with d-bus support
2. --with-modules, Build with dynamic modules support
3. --with-xml2, Build with libxml2 support
@@ -50,7 +51,7 @@ brew tap railwaycat/emacsmacport Start off by tapping the official emacs-plus cask. -```shell +```sh brew tap d12frosted/emacs-plus ``` @@ -58,19 +59,19 @@ Emacs Plus contains separate formulas for different Emacs versions: * emacs-plus - installs Emacs 26, current release version. -```shell +```sh brew install emacs-plus [options] ``` * emacs-plus@27 - installs Emacs 27, next release version. -```shell +```sh brew install emacs-plus@27 [options] ``` * emacs-plus@28 - installs Emacs 28, development version. -```shell +```sh brew install emacs-plus@28 [options] ``` @@ -109,7 +110,7 @@ Spacemacs can be used naturally by both Emacs and Vim users -- you can even mix 1. If you have an existing Emacs configuration, back it up first: - ```sh + ```console cd ~ mv .emacs.d .emacs.d.bak mv .emacs .emacs.bak @@ -158,7 +159,7 @@ This is [Purcell's](https://github.com/purcell/emacs.d) emacs configuration tree To install, clone this repository to `~/.emacs.d`, i.e. ensure that the `init.el` contained in this repository ends up at `~/.emacs.d/init.el`: -```shell +```sh git clone https://github.com/purcell/emacs.d.git ~/.emacs.d ``` @@ -170,7 +171,7 @@ Upon starting up Emacs for the first time, further third-party packages will be ### Installation -```shell +```console git clone https://github.com/hlissner/doom-emacs ~/.emacs.d cd ~/.emacs.d cp init.example.el init.el # maybe edit init.el diff --git a/Git/README.md b/Git/README.md index 9c54719f..3934b53e 100644 --- a/Git/README.md +++ b/Git/README.md @@ -88,7 +88,7 @@ eval "$(ssh-agent -s)" If you're running macOS Sierra 10.12.2 or later, you will need to modify your `~/.ssh/config` file to automatically load keys into the ssh-agent and store passphrases in your keychain: -```keychain +```sh Host * AddKeysToAgent yes UseKeychain yes diff --git a/Git/gitignore.md b/Git/gitignore.md index f3a760b3..2ce89cfe 100644 --- a/Git/gitignore.md +++ b/Git/gitignore.md @@ -2,7 +2,7 @@ Create the file `~/.gitignore` as shown below -```gitignore +```sh # Folder view configuration files .DS_Store Desktop.ini @@ -29,7 +29,7 @@ node_modules followed by running the command below, in terminal: -```bash +```sh git config --global core.excludesfile ~/.gitignore ``` @@ -39,7 +39,7 @@ Or simply download [macOS specific .gitignore](https://github.com/github/gitigno >**Note**: You can also download it using curl ->```bash +>```sh >curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore -o ~/.gitignore >``` diff --git a/Go/README.md b/Go/README.md index f0c837ba..09f69707 100644 --- a/Go/README.md +++ b/Go/README.md @@ -51,7 +51,7 @@ func main() { Run the program by running: -```sh +```console $ go run hello.go Hello World! ``` @@ -64,7 +64,7 @@ go install . Since you have `$GOPATH/bin` added to your `$PATH`, you can run your program from anywhere: -```sh +```console $ hello Hello World! ``` diff --git a/Heroku/README.md b/Heroku/README.md index 94383b56..90fe369a 100644 --- a/Heroku/README.md +++ b/Heroku/README.md @@ -4,13 +4,17 @@ ## Installation -Assuming that you have an Heroku account ([sign up](https://signup.heroku.com) if you don't), let's install the [Heroku Client](https://devcenter.heroku.com/articles/using-the-cli) for the command-line using Homebrew. +Assuming you have a Heroku account ([sign up](https://signup.heroku.com) if you don't), let's install the [Heroku Client](https://devcenter.heroku.com/articles/using-the-cli) for the command-line using Homebrew. - brew install heroku/brew/heroku +```sh +brew install heroku/brew/heroku +``` The formula might not have the latest version of the Heroku Client, which is updated pretty often. Let's update it now: - heroku update +```sh +heroku update +``` Don't be afraid to run `heroku update` every now and then to always have the most recent version. @@ -18,18 +22,24 @@ Don't be afraid to run `heroku update` every now and then to always have the mos Login to your Heroku account using your email and password: - heroku login +```sh +heroku login +``` If this is a new account, and since you don't already have a public **SSH key** in your `~/.ssh` directory, it will offer to create one for you. It will also upload the key to your Heroku account, which will allow you to deploy apps from this computer. If it didn't offer create the SSH key for you (i.e. your Heroku account already has SSH keys associated with it), you can do so manually by running: - mkdir ~/.ssh - ssh-keygen -t rsa +```sh +mkdir ~/.ssh +ssh-keygen -t rsa +``` Keep the default file name and skip the passphrase by just hitting Enter both times. Then, add the key to your Heroku account: - heroku keys:add +```sh +heroku keys:add +``` ## Usage @@ -37,10 +47,12 @@ Once your keys are in place and you are authorized, you're ready to deploy apps. A cheat sheet for deployment: - cd myapp/ - heroku create myapp - git push heroku master - heroku ps - heroku logs -t +```console +$ cd myapp/ +$ heroku create myapp +$ git push heroku master +$ heroku ps +$ heroku logs -t +``` The [Heroku Dev Center](https://devcenter.heroku.com/) is where you will find more information. diff --git a/Homebrew/README.md b/Homebrew/README.md index d86677e0..e97399e7 100644 --- a/Homebrew/README.md +++ b/Homebrew/README.md @@ -11,12 +11,17 @@ to build things from source, and if you are missing this it's available through the App Store > Updates. You can also install it from the terminal by running the following: - sudo xcode-select --install +```sh +sudo xcode-select --install +``` -To install Homebrew run the following in a terminal, hit **Enter**, and follow -the steps on the screen: +To install Homebrew run the following in a terminal: - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +```sh +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +``` + +hit **Enter**, and follow the steps on the screen. ### Setting up your `PATH` @@ -28,7 +33,9 @@ You change your path by adding `/usr/local/bin` to your `PATH` environment varia This can be done on a per-user basis by adjusting `PATH` in your `~/.bash_profile`. To do this, run: - echo 'PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile +```console +$ echo 'PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile +``` (If you're using `zsh`, you should do this for `~/.zshrc` in addition to `~/.bash_profile`.) @@ -40,7 +47,9 @@ major shells. An admin password will be required if you modify the file. Then, to be able to use `brew` you need to start a new terminal session. After that you should make sure everything is working by running: - brew doctor +```sh +brew doctor +``` If everything is good, you should see no warnings, and a message that you are "ready to brew!". diff --git a/Homebrew/Usage.md b/Homebrew/Usage.md index 7fb04ed0..5cd85123 100644 --- a/Homebrew/Usage.md +++ b/Homebrew/Usage.md @@ -2,50 +2,72 @@ To install a package (or **Formula** in Homebrew vocabulary) simply type: - brew install +```sh +brew install +``` To update Homebrew's directory of formulae, run: - brew update +```sh +brew update +``` **Note**: If that command fails you can manually download the directory of formulas like this: - cd /usr/local/Homebrew/ - git fetch origin - git reset --hard origin/master +```console +$ cd /usr/local/Homebrew/ +$ git fetch origin +$ git reset --hard origin/master +``` To see if any of your formulas need to be updated: - brew outdated +```sh +brew outdated +``` To update a formula: - brew upgrade +```sh +brew upgrade +``` Homebrew keeps older versions of formulas installed on your system, in case you -want to roll back to an older version. That rarely is necessary, so you can do +want to roll back to an older version. That is rarely necessary, so you can do some cleanup to get rid of those old versions: - brew cleanup +```sh +brew cleanup +``` -If you want to see what formulas Homebrew would delete _without actually +If you want to see what formulae Homebrew would delete _without actually deleting them_, you can run: - brew cleanup --dry-run +```sh +brew cleanup --dry-run +``` To see what you have installed (with their version numbers): - brew list --versions +```sh +brew list --versions +``` To search for formulas you run: - brew search +```sh +brew search +``` To get more information about a formula you run: - brew info +```sh +brew info +``` To uninstall a formula you can run: - brew uninstall +```sh +brew uninstall +``` diff --git a/Java/README.md b/Java/README.md index 77970a50..0703e17a 100644 --- a/Java/README.md +++ b/Java/README.md @@ -19,13 +19,17 @@ and that's what we'll be covering here. First you should check if Java is already installed - java -version +```sh +java -version +``` If you see a non-empty output like below then Java is already installed on your machine and you are good to go - openjdk version "13.0.2" 2020-01-14 - OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.2+8) - OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.2+8, mixed mode, sharing) +```sh +openjdk version "13.0.2" 2020-01-14 +OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.2+8) +OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.2+8, mixed mode, sharing) +``` If you don't see the output like above then you need to install Java on your system @@ -33,11 +37,15 @@ If you don't see the output like above then you need to install Java on your sys #### Installing OpenJDK using Homebrew - brew install openjdk +```sh +brew install openjdk +``` If you're curious, you can list all the available JDK versions via: - brew search jdk +```sh +brew search jdk +``` There will be a lot of options here! If you are not a serious Java developer, don't worry about them, and just use the default `openjdk`. diff --git a/Java/sdkman.md b/Java/sdkman.md index 32672e53..2bf4abe5 100644 --- a/Java/sdkman.md +++ b/Java/sdkman.md @@ -6,26 +6,26 @@ SDKMAN! is a tool for managing parallel versions of multiple software developmen Open a new terminal and enter: -```bash +```sh curl -s "https://get.sdkman.io" | bash ``` Follow the instructions on-screen to complete installation. Next, open a new terminal or enter: -```bash +```sh source "$HOME/.sdkman/bin/sdkman-init.sh" ``` Lastly, run the following code snippet to ensure that installation succeeded: -```bash +```sh sdk version ``` If all went well, the version should be displayed. Something like: -```bash +```sh sdkman 5.0.0+51 ``` @@ -37,13 +37,13 @@ sdkman 5.0.0+51 Install the latest stable version of your SDK of choice (say, Java JDK) by running the following command: -```bash +```sh sdk install java ``` You will see something like the following output: -```bash +```sh Downloading: java 8u111 In progress... @@ -56,7 +56,7 @@ Done installing! Now you will be prompted if you want this version to be set as default. -```bash +```sh Do you want java 8u111 to be set as default? (Y/n): Answering yes (or hitting enter) will ensure that all subsequent shells opened will have this version of the SDK in use by default. Setting java 8u111 as default. @@ -67,13 +67,13 @@ Setting java 8u111 as default. * To install a specific version qualify the version you require: -```bash +```sh sdk install scala 2.12.1 ``` * To remove a version -```bash +```sh sdk uninstall scala 2.11.6 ``` @@ -81,7 +81,7 @@ Note that removing a local version will not remove the local installation. * To list candidates -```bash +```sh sdk list ``` diff --git a/MyySQL/README.md b/MyySQL/README.md index 9c6c4f20..cd80f366 100644 --- a/MyySQL/README.md +++ b/MyySQL/README.md @@ -6,29 +6,41 @@ We will install [MySQL](http://www.mysql.com/) using Homebrew, which will also i > **Note**: Sequel Pro does not support latest MySQL (version 8), because of that you may want to install MySQL 5.7 instead - `brew install mysql@5.7`. - brew install mysql +```sh +brew install mysql +``` ## Usage To have launchd start MySQL now and restart at login: - brew services start mysql +```sh +brew services start mysql +``` Or, if you don't want/need a background service you can just use the `mysql.server` tool: - mysql.server start +```sh +mysql.server start +``` To stop it when you are done, run: - mysql.server stop +```sh +mysql.server stop +``` You can see the different commands available for `mysql.server` with: - mysql.server --help +```sh +mysql.server --help +``` To connect with the command-line client, run: - mysql -uroot +```sh +mysql -uroot +``` (Use `exit` to quit the MySQL shell) @@ -40,4 +52,6 @@ It is always nice to have a GUI tool for managing databases. For Mac, you can us You may install Sequel Pro using [homebrew](http://sourabhbajaj.com/mac-setup/Homebrew/Cask.html): - brew cask install sequel-pro +```sh +brew cask install sequel-pro +``` diff --git a/Node.js/README.md b/Node.js/README.md index b8678b4b..2862daae 100644 --- a/Node.js/README.md +++ b/Node.js/README.md @@ -6,23 +6,29 @@ Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. ### Using Homebrew - brew install node +```sh +brew install node +``` ### Using Node Version Manager (nvm) Download and install [nvm](https://github.com/creationix/nvm) by running: - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash +```sh +curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash +``` Then download Node and select your version by running: - source ~/.bashrc # source your bashrc/zshrc to add nvm to PATH - command -v nvm # check the nvm use message - nvm install node # install most recent Node stable version - nvm ls # list installed Node version - nvm use node # use stable as current version - nvm ls-remote # list all the Node versions you can install - nvm alias default node # set the installed stable version as the default Node +```console +$ source ~/.bashrc # source your bashrc/zshrc to add nvm to PATH +$ command -v nvm # check the nvm use message +$ nvm install node # install most recent Node stable version +$ nvm ls # list installed Node version +$ nvm use node # use stable as current version +$ nvm ls-remote # list all the Node versions you can install +$ nvm alias default node # set the installed stable version as the default Node +``` See the [documentation](https://github.com/creationix/nvm#installation) for information. @@ -30,25 +36,37 @@ See the [documentation](https://github.com/creationix/nvm#installation) for info To install a package: - npm install # Install locally - npm install -g # Install globally +```sh +npm install # Install locally +npm install -g # Install globally +``` To install a package and save it in your project's `package.json` file: - npm install --save +```sh +npm install --save +``` To see what's installed: - npm list [-g] +```sh +npm list [-g] +``` To find outdated packages: - npm outdated [-g] +```sh +npm outdated [-g] +``` To upgrade all or a particular package: - npm update [-g] [] +```sh +npm update [-g] [] +``` To uninstall a package: - npm uninstall [-g] +```sh +npm uninstall [-g] +``` diff --git a/Perl/README.md b/Perl/README.md index 73c09c14..a0d4a95d 100644 --- a/Perl/README.md +++ b/Perl/README.md @@ -15,13 +15,13 @@ is [cpanminus](https://metacpan.org/pod/App::cpanminus) (`cpanm`). ### Homebrew -```bash +```sh brew install perl cpanminus ``` ### Perlbrew -```bash +```sh curl -L https://install.perlbrew.pl | bash source ~/perl5/perlbrew/etc/bashrc @@ -33,7 +33,7 @@ echo source ~/perl5/perlbrew/etc/bashrc >> ~/.bash_profile Other useful commands: -```bash +```sh # full documentation perlbrew help @@ -54,7 +54,7 @@ perlbrew clone-modules $from $to To install additional modules from [CPAN](https://www.cpan.org): -```bash +```sh cpanm Modern::Perl ``` diff --git a/PostgreSQL/README.md b/PostgreSQL/README.md index 48487371..b146c3b0 100644 --- a/PostgreSQL/README.md +++ b/PostgreSQL/README.md @@ -4,41 +4,59 @@ PostgreSQL is an open source relational database management system (RDBMS). It i ## Installation - brew install postgres +```sh +brew install postgres +``` After this, we can test the installation status by checking the version of installed PostgreSQL - postgres -V +```sh +postgres -V +``` ## Usage ### Start PostgreSQL server - pg_ctl -D /usr/local/var/postgres start +```sh +pg_ctl -D /usr/local/var/postgres start +``` Or you can start the PostgreSQL server and have it start up at login automatically - brew services start postgresql +```sh +brew services start postgresql +``` ### Stop PostgreSQL server - pg_ctl -D /usr/local/var/postgres stop +```sh +pg_ctl -D /usr/local/var/postgres stop +``` To make it stop starting up automatically at login - brew services stop postgresql +```sh +brew services stop postgresql +``` ### Restart PostgreSQL server - pg_ctl -D /usr/local/var/postgres restart +```sh +pg_ctl -D /usr/local/var/postgres restart +``` Or if you're using `homebrew` - brew services restart postgresql +```sh +brew services restart postgresql +``` ### Start PostgreSQL console - psql +```console +$ psql +``` ### GUI tool @@ -46,4 +64,6 @@ PostgreSQL is an open source relational database management system (RDBMS). It i Install `psequel` using `homebrew` and `cask` - brew cask install psequel +```sh +brew cask install psequel +``` diff --git a/Python/README.md b/Python/README.md index 86291b57..92d5aa2c 100644 --- a/Python/README.md +++ b/Python/README.md @@ -15,18 +15,24 @@ to install Python 2.7 you'll have to be explicit about it. #### Python 3 - brew install python +```sh +brew install python +``` #### Python 2.7 - brew install python@2 +```sh +brew install python@2 +``` Installing Python also installs [pip](https://pypi.org/project/setuptools/) (and its dependency [Setuptools](https://pypi.python.org/pypi/setuptools)), which is the package manager for Python. Let's upgrade them both: - pip install --upgrade setuptools - pip install --upgrade pip +```sh +pip install --upgrade setuptools +pip install --upgrade pip +``` Executable scripts from Python packages you install will be put in `/usr/local/share/python`, make sure it's on your `PATH`. @@ -37,41 +43,55 @@ Executable scripts from Python packages you install will be put in manage and install different versions of Python. Works very much like `rbenv` for Ruby. First, we must install `pyenv` using Homebrew: - brew install pyenv +```sh +brew install pyenv +``` To upgrade `pyenv` in the future, use `upgrade` instead of `install`. After installing, add `pyenv init` to your shell to enable shims and autocompletion (use `.zshrc` if you're using `zsh`). - echo 'eval "$(pyenv init -)"' >> ~/.bash_profile +```sh +echo 'eval "$(pyenv init -)"' >> ~/.bash_profile +``` Restart your shell so the path changes take effect. - exec $SHELL +```console +exec $SHELL +``` You can now begin using `pyenv`. To list the all available versions of Python, including Anaconda, Jython, PyPy and Stackless, use: - pyenv install --list +```sh +pyenv install --list +``` Then install the desired versions: - pyenv install 2.7.12 - pyenv install 3.5.2 +```sh +pyenv install 2.7.12 +pyenv install 3.5.2 +``` Use the `global` command to set global version(s) of Python to be used in all shells. For example, if you prefer 2.7.12 over 3.5.2: - pyenv global 2.7.12 3.5.2 - pyenv rehash +```sh +pyenv global 2.7.12 3.5.2 +pyenv rehash +``` The leading version takes priority. All installed Python versions can be located in `~/.pyenv/versions`. Alternatively, you can run: - $ pyenv versions - system (set by /Users/your_account/.pyenv/version) - * 2.7.12 - * 3.5.2 +```console +$ pyenv versions + system (set by /Users/your_account/.pyenv/version) +* 2.7.12 +* 3.5.2 +``` This shows an asterisk `*` next to the currently active version. @@ -82,12 +102,14 @@ writing the version name to a `.python-version` file in the current directory. This version overrides the global version. For example, to install anaconda3-4.1.1 in `path/to/directory`: - $ pyenv install anaconda3-4.1.1 - $ cd path/to/directory - $ pyenv local anaconda3-4.1.1 - $ pyenv rehash - $ pyenv versions - system - 2.7.12 - 3.5.2 - * anaconda3-4.1.1 (set by /Users/your_account/path/to/directory/.python-version) +```console +$ pyenv install anaconda3-4.1.1 +$ cd path/to/directory +$ pyenv local anaconda3-4.1.1 +$ pyenv rehash +$ pyenv versions + system + 2.7.12 + 3.5.2 +* anaconda3-4.1.1 (set by /Users/your_account/path/to/directory/.python-version) +``` diff --git a/Python/ipython.md b/Python/ipython.md index 99c0b08b..d5a0c251 100644 --- a/Python/ipython.md +++ b/Python/ipython.md @@ -5,10 +5,20 @@ IPython is a kernel for Jupyter Notebook. If you are confused IPython with Jupyt ## Installation - pip install ipython +```sh +pip install ipython +``` -If you want a more fine grained command you can try the following: +If you want a more fine-grained command you can try the following: -For zsh -> `pip install 'ipython[zmq,qtconsole,notebook,test]'` +For zsh -> -For bash -> `pip install ipython[zmq,qtconsole,notebook,test]` +```sh +pip install 'ipython[zmq,qtconsole,notebook,test]' +``` + +For bash -> + +```sh +pip install ipython[zmq,qtconsole,notebook,test] +``` diff --git a/Python/numpy.md b/Python/numpy.md index 17156135..77cd3762 100644 --- a/Python/numpy.md +++ b/Python/numpy.md @@ -8,12 +8,12 @@ There are two ways to install these libraries: Python provides an inbuilt package management system `pip` which can be used to install these libraries -```bash +```sh python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose ``` * Using [MacPorts](https://www.macports.org/) and Python 3.5 -```bash +```sh sudo port install py35-numpy py35-scipy py35-matplotlib py35-ipython +notebook py35-pandas py35-sympy py35-nose ``` diff --git a/Python/pip.md b/Python/pip.md index 1e894d28..901f3876 100644 --- a/Python/pip.md +++ b/Python/pip.md @@ -4,12 +4,16 @@ macOS comes with Python so there's a chance `pip` is already installed on your m ## Installation - curl https://bootstrap.pypa.io/get-pip.py > get-pip.py - sudo python get-pip.py +```console +curl https://bootstrap.pypa.io/get-pip.py > get-pip.py +sudo python get-pip.py +``` To verify `pip` is installed properly run - pip --version +```console +$ pip --version +``` If it returns a version `pip` was successfully installed. @@ -19,16 +23,24 @@ Here are a few `pip` commands to get you started. Install a Python package - pip install +```sh +pip install +``` Upgrade a package - pip install --upgrade +```sh +pip install --upgrade +``` See what's installed - pip freeze +```sh +pip freeze +``` Uninstall a package - pip uninstall +```sh +pip uninstall +``` diff --git a/Python/virtualenv.md b/Python/virtualenv.md index 0fc39f9a..9e684add 100644 --- a/Python/virtualenv.md +++ b/Python/virtualenv.md @@ -12,38 +12,50 @@ use `virtualenv` when dealing with Python applications. To install `virtualenv` run: - pip install virtualenv +```sh +pip install virtualenv +``` ## Usage If you have a project in a directory called `my-project` you can set up `virtualenv` for that project by running: - cd my-project/ - virtualenv venv +```console +$ cd my-project/ +$ virtualenv venv +``` If you want your `virtualenv` to also inherit globally installed packages run: - virtualenv venv --system-site-packages +```sh +virtualenv venv --system-site-packages +``` These commands create a `venv/` directory in your project where all dependencies are installed. You need to **activate** it first though (in every terminal instance where you are working on your project): - source venv/bin/activate +```console +$ source venv/bin/activate +``` You should see a `(venv)` appear at the beginning of your terminal prompt indicating that you are working inside the `virtualenv`. Now when you install something like this: - pip install +```sh +pip install +``` It will get installed in the `venv/` folder, and not conflict with other projects. To leave the virtual environment run: - deactivate +```console +$ deactivate +``` **Important**: Remember to add `venv` to your project's `.gitignore` file so you don't include all of that in your source code. @@ -60,7 +72,9 @@ dependency conflicts. To install `virtualenvwrapper` run: - pip install virtualenvwrapper +```sh +pip install virtualenvwrapper +``` Depending on your setup you might need to install it using `sudo`. Read the [installation diff --git a/References/README.md b/References/README.md index 8e01c037..a7eb7aed 100644 --- a/References/README.md +++ b/References/README.md @@ -1,6 +1,6 @@ # Credits & References -Thank you for all the awesome pages and documentation below that helped set this up. +Thank you for all the awesome pages and documentation below which helped set this up. - [Nicolashery](https://github.com/nicolashery/mac-dev-setup) - [GitHub](https://help.github.com/articles) diff --git a/Ruby/README.md b/Ruby/README.md index bf0b3de1..5e3c63f4 100644 --- a/Ruby/README.md +++ b/Ruby/README.md @@ -4,29 +4,37 @@ macOS comes with Ruby installed, but as we don't want to be messing with operati ## Installation - brew install rbenv ruby-build rbenv-default-gems rbenv-gemset - echo 'eval "$(rbenv init -)"' >> ~/Projects/config/env.sh - source ~/.zshrc # Apply changes +```sh +brew install rbenv ruby-build rbenv-default-gems rbenv-gemset +echo 'eval "$(rbenv init -)"' >> ~/Projects/config/env.sh +source ~/.zshrc # Apply changes +``` -The packages we just installed allow us to install different versions of Ruby and specify which version to use on a per project basis and globally. This is very useful to keep a consistent development environment if you need to work in a particular Ruby version. +wThe packages we just installed allow us to install different versions of Ruby and specify which version to use on a per project basis and globally. This is very useful to keep a consistent development environment if you need to work in a particular Ruby version. ## Switching versions We can install version 2.1.1 and use it as our global version by running: - rbenv install 2.1.1 - rbenv global 2.1.1 +```sh +rbenv install 2.1.1 +rbenv global 2.1.1 +``` ## Managing gems in application Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. - gem install bundler - echo 'bundler' >> "$(brew --prefix rbenv)/default-gems" +```sh +gem install bundler +echo 'bundler' >> "$(brew --prefix rbenv)/default-gems" +``` When starting a Ruby project, you can have sandboxed collections of gems. This lets you have multiple collections of gems installed in different sandboxes, and specify (on a per-application basis) which sets of gems should be used. To have gems install into a sub-folder in your project directory for easy later removal / editing / testing, you can use a project gemset. - echo '.gems' > /.rbenv-gemsets +```console +$ echo '.gems' > /.rbenv-gemsets +``` Your gems will then get installed in `project/.gems`. @@ -34,4 +42,6 @@ Your gems will then get installed in `project/.gems`. If you use Google for finding your Gem documentation then you might want to consider saving a bit of time when installing gems by not including the documentation. - echo 'gem: --no-document' >> ~/.gemrc +```console +$ echo 'gem: --no-document' >> ~/.gemrc +``` diff --git a/Ruby/RubyGems.md b/Ruby/RubyGems.md index d2880073..cf391cc1 100644 --- a/Ruby/RubyGems.md +++ b/Ruby/RubyGems.md @@ -2,40 +2,56 @@ [RubyGems](http://rubygems.org/), the Ruby package manager, should be installed on your machine if you previously have installed Ruby. Verify this by running: - which gem +```console +$ which gem +``` ## Update RubyGems To update to its latest version with: - gem update --system +```sh +gem update --system +``` ## Install gems To install a _gem_ (Ruby package), run: - gem install +```sh +gem install +``` To install without generating the documentation for each gem (faster): - gem install --no-document +```sh +gem install --no-document +``` ## List installed gems - gem list +```sh +gem list +``` To check if any installed gems are outdated: - gem outdated +```sh +gem outdated +``` ## Update installed gems To update all gems or a particular gem: - gem update [] +```sh +gem update [] +``` ## Remove old gem versions RubyGems keeps old versions of gems, so feel free to do some cleaning after updating: - gem cleanup +```sh +gem cleanup +``` diff --git a/Scala/README.md b/Scala/README.md index 25ab5ef7..b7b27f36 100644 --- a/Scala/README.md +++ b/Scala/README.md @@ -2,13 +2,17 @@ Make sure you have Java installed, the instructions are provided [here](/mac-setup/Java/README.html). - brew update - brew install scala sbt +```sh +brew update +brew install scala sbt +``` (This step is optional) Update the `/usr/local/etc/sbtopts` by running the command below. - echo '-J-XX:+CMSClassUnloadingEnabled' >> /usr/local/etc/sbtopts - echo '-J-Xmx2G' >> /usr/local/etc/sbtopts +```console +$ echo '-J-XX:+CMSClassUnloadingEnabled' >> /usr/local/etc/sbtopts +$ echo '-J-Xmx2G' >> /usr/local/etc/sbtopts +``` ## Scala Plugin for Eclipse diff --git a/SublimeText/Preferences.md b/SublimeText/Preferences.md index 87b3d560..07f6c577 100644 --- a/SublimeText/Preferences.md +++ b/SublimeText/Preferences.md @@ -2,7 +2,7 @@ This is an example of User Settings for a basic development but please feel free to modify or update as per your choice. -~~~json +```json { "auto_complete_delay": 5, "auto_complete_selector": "source, text", @@ -46,4 +46,4 @@ This is an example of User Settings for a basic development but please feel free "translate_tabs_to_spaces": true, "word_wrap": true } -~~~ +``` diff --git a/SublimeText/README.md b/SublimeText/README.md index 55ebcb36..f2962854 100755 --- a/SublimeText/README.md +++ b/SublimeText/README.md @@ -8,9 +8,11 @@ ## Use CLI to open file -Let's create a shortcut so we can launch Sublime Text from the command-line +Let's create a shortcut through which we can launch Sublime Text from the command-line - ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl +```console +$ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl +``` Now you can open a file with `subl myfile.py` or start a new project in the current directory with `subl .`. diff --git a/SublimeText/SublimeLinter.md b/SublimeText/SublimeLinter.md index 64149102..844936bc 100644 --- a/SublimeText/SublimeLinter.md +++ b/SublimeText/SublimeLinter.md @@ -1,6 +1,6 @@ # SublimeLinter Settings -~~~json +```json { "user": { "debug": false, @@ -53,4 +53,4 @@ "wrap_find": true } } -~~~ +``` diff --git a/SystemPreferences/README.md b/SystemPreferences/README.md index 57c930f2..8d15f550 100644 --- a/SystemPreferences/README.md +++ b/SystemPreferences/README.md @@ -33,9 +33,9 @@ suggestions. Always choose the setting that makes the most sense to you.** - _Other settings_ - Remove _workspace auto-switching_ by running the following command: -```shell -defaults write com.apple.dock workspaces-auto-swoosh -bool NO -killall Dock # Restart the Dock process +```console +$ defaults write com.apple.dock workspaces-auto-swoosh -bool NO +$ killall Dock # Restart the Dock process ``` ## Finder @@ -80,7 +80,7 @@ Instructions [here](https://sourabhbajaj.com/mac-setup/Homebrew/README.html). ### 2) Update Homebrew formulae -```shell +```sh brew update ``` @@ -89,13 +89,13 @@ brew update If you are on macOS El Capitan (10.11), install the (3.x.x) from [the repo](https://github.com/osxfuse/osxfuse/releases). -```shell +```sh brew cask install osxfuse ``` ### 4) Install ntfs-3g -```shell +```sh brew install ntfs-3g ``` @@ -104,7 +104,7 @@ brew install ntfs-3g - **Reboot** and hold `CMD + R` to get in recovery mode - Open the terminal and type: -```shell +```sh csrutil disable ``` @@ -112,7 +112,7 @@ csrutil disable ### 6) Create a symlink for mount_ntfs -```shell +```sh sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.original sudo ln -s /usr/local/sbin/mount_ntfs /sbin/mount_ntfs ``` @@ -122,7 +122,7 @@ sudo ln -s /usr/local/sbin/mount_ntfs /sbin/mount_ntfs - **Reboot** and hold `CMD + R` to get in recovery mode - Open the terminal and type: -```shell +```sh csrutil enable ``` diff --git a/Vagrant/README.md b/Vagrant/README.md index 953ae600..d3c16205 100644 --- a/Vagrant/README.md +++ b/Vagrant/README.md @@ -12,38 +12,54 @@ Vagrant uses [Virtualbox](https://www.virtualbox.org/) to manage the virtual dep Notice that macOS High Sierra 10.13 introduces a new feature that requires user approval before loading new third-party kernel extensions. In case of failure follow the instructions [here](https://developer.apple.com/library/archive/technotes/tn2459/_index.html). - brew cask install virtualbox +```sh +brew cask install virtualbox +``` Now install Vagrant either [from the website](http://www.vagrantup.com/downloads.html) or use Homebrew for installing it. - brew cask install vagrant +```sh +brew cask install vagrant +``` [Vagrant-Manager](http://vagrantmanager.com/) helps you manage all your virtual machines in one place directly from the menu bar. - brew cask install vagrant-manager +```sh +brew cask install vagrant-manager +``` ## Usage Add the Vagrant box you want to use. We'll use Ubuntu 12.04 for the following example. - vagrant box add precise64 https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/virtualbox.box +```console +$ vagrant box add precise64 https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/virtualbox.box +``` You can find more boxes at [Vagrant Cloud](https://app.vagrantup.com/boxes/search). Now create a test directory and `cd` into the test directory. Then we'll initialize the vagrant machine. - vagrant init precise64 +```console +$ vagrant init precise64 +``` Now lets start the machine using the following command. - vagrant up +```console +$ vagrant up +``` You can ssh into the machine now. - vagrant ssh +```console +$ vagrant ssh +``` Halt the vagrant machine now. - vagrant halt +```console +$ vagrant halt +``` Other useful commands are `suspend` and `destroy`. diff --git a/Vim/README.md b/Vim/README.md index 787e7868..5b855d6b 100644 --- a/Vim/README.md +++ b/Vim/README.md @@ -6,7 +6,7 @@ To install the latest version, use homebrew: -```bash +```sh brew install vim ``` @@ -16,34 +16,34 @@ brew install vim To download the The Ultimate vimrc, you need to install the git client. If you need install it, use home brew: -```bash +```sh brew install git ``` Now, download the vimrc files: -```bash +```sh git clone https://github.com/amix/vimrc.git ~/.vim_runtime ``` To install the complete version, run: -```bash -sh ~/.vim_runtime/install_awesome_vimrc.sh +```console +$ sh ~/.vim_runtime/install_awesome_vimrc.sh ``` To install the _basic_ version, run: -```bash -sh ~/.vim_runtime/install_basic_vimrc.sh +```console +$ sh ~/.vim_runtime/install_basic_vimrc.sh ``` ### Update To update the vimrc scripts, run: -```bash -cd ~/.vim_runtime && git pull --rebase && cd - +```console +$ cd ~/.vim_runtime && git pull --rebase && cd - ``` ## Maximum Awesome @@ -54,15 +54,15 @@ cd ~/.vim_runtime && git pull --rebase && cd - To install it, just make a clone of the repository with the git client: -```bash +```sh git clone https://github.com/square/maximum-awesome.git ``` Then install it: -```bash -cd maximum-awesome -rake +```console +$ cd maximum-awesome +$ rake ``` > **NOTE:** the rake command will install all dependencies needed. diff --git a/VisualStudioCode/README.md b/VisualStudioCode/README.md index 2bf0cb66..a9748503 100644 --- a/VisualStudioCode/README.md +++ b/VisualStudioCode/README.md @@ -6,7 +6,7 @@ To install the latest version, use Homebrew: -```bash +```sh brew cask install visual-studio-code ``` diff --git a/Xcode/README.md b/Xcode/README.md index b1ebe11c..3f67f6df 100644 --- a/Xcode/README.md +++ b/Xcode/README.md @@ -6,7 +6,9 @@ Download and install it from the App Store or from [Apple's website](https://dev For installing Xcode command line tools run: - xcode-select --install +```sh +xcode-select --install +``` It'll prompt you to install the command line tools. Follow the instructions and you'll have Xcode and Xcode command line tools both installed. diff --git a/iTerm/README.md b/iTerm/README.md index 26896e7e..cfef26aa 100644 --- a/iTerm/README.md +++ b/iTerm/README.md @@ -6,7 +6,9 @@ Use [Homebrew](http://sourabhbajaj.com/mac-setup/Homebrew/) to download and install: - brew cask install iterm2 +```sh +brew cask install iterm2 +``` ## Customization diff --git a/iTerm/ack.md b/iTerm/ack.md index 09ba46b1..b194b502 100644 --- a/iTerm/ack.md +++ b/iTerm/ack.md @@ -7,7 +7,7 @@ To install the latest version, use homebrew. -```bash +```sh brew install ack ``` @@ -20,7 +20,7 @@ brew install ack ## Usage -```bash +```sh ack [OPTION]... PATTERN [FILES OR DIRECTORIES] ``` @@ -33,7 +33,7 @@ ack --js pancakes Or you may want to find all files that _does not_ contain the word _brew_ -```bash +```sh ack -L brew ``` @@ -46,20 +46,20 @@ For example, you can add a custom type to use as a flag when searching. The following configuration will allow you to only search in `.md`, `.mkd` and `.markdown` files using the `--markdown` flag. -```bash +```sh --type-set=markdown=.md,.mkd,.markdown ``` You can also tell ack to always sort and use colors in the result. -```bash +```sh --sort-files --color ``` To see what configuration `ack` uses you can use the `dump` flag. -```bash +```sh ack --dump ``` diff --git a/iTerm/autojump.md b/iTerm/autojump.md index 3a2afa0c..4f60cc4c 100644 --- a/iTerm/autojump.md +++ b/iTerm/autojump.md @@ -6,7 +6,7 @@ To install the latest version, use homebrew: -```bash +```sh brew install autojump ``` @@ -14,12 +14,12 @@ brew install autojump Navigate to your most-visited directories as usual using `cd`, for example if you had a directory called `work/github/mac-setup` -```bash +```sh cd work/github/mac-setup ``` The next time you want to navigate to the same directory, use autojump like so - -```bash +```sh j mac-setup ``` diff --git a/iTerm/fzf.md b/iTerm/fzf.md index e620e70a..066b0899 100644 --- a/iTerm/fzf.md +++ b/iTerm/fzf.md @@ -31,7 +31,7 @@ Add any of these functions to your shell configuration file and apply the changes to try them out. Or just paste the function in your terminal if you just want to try it out without saving it. -```sh +```console # fd - cd to selected directory fd() { local dir @@ -41,7 +41,7 @@ fd() { } ``` -```sh +```console # fh - search in your command history and execute selected command fh() { eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//') @@ -57,7 +57,7 @@ fh() { Open up your shell config and add following function: -```sh +```console # ch - browse chrome history ch() { local cols sep diff --git a/iTerm/tree.md b/iTerm/tree.md index 52bcfb7a..2ad16e1a 100644 --- a/iTerm/tree.md +++ b/iTerm/tree.md @@ -6,7 +6,7 @@ To install the latest version, use homebrew: -```bash +```sh brew install tree ``` @@ -14,7 +14,7 @@ brew install tree Running `tree` will produce output like this: -```bash +```sh . ├── Apps │   ├── Octave.md @@ -41,13 +41,13 @@ Running `tree` will produce output like this: To limit the recursion you can pass an `-L` flag and specify the maximum depth `tree` will use when searching. -```bash +```sh tree -L 1 ``` will output: -```bash +```sh . ├── Apps ├── CONTRIBUTING.md diff --git a/iTerm/zsh.md b/iTerm/zsh.md index f842a519..f3612e99 100644 --- a/iTerm/zsh.md +++ b/iTerm/zsh.md @@ -94,7 +94,7 @@ git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$H Next create your `~/.zshrc` by running: -```sh +```console setopt EXTENDED_GLOB for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"