Prerequisites: Native Windows 10 PC (I am using Windows 10 Home with the Fall Creators Update)
// type bash and hit [enter] to start a bash shell instance
bash
// <values> are meant to be replaced with a real value
$ gem update <gemname>
There are certain things you can do to make you command prompt experience more enjoyable. These automation steps are optional, but make life easier
For me, Git CMD would not scroll by default and the Git Bash scroll fix did not work for Git CMD. This is an issue when a command prints more lines of text than fit in the window. For example, I would run $ rvm -h and would be unable to see everything it returns such as warnings and errors that are printed first. I found the solution in Git CMD's Properties.
You need to be able to use $ bash from a cmd prompt.
To do this, use the following steps:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
You should now be able to type the $ bash command into any command prompt (e.g. cmd.exe, git cmd) to create a bash shell instance in Windows.
// start a bash instance
bash
// update and upgrade Ubuntu using apt-get
$ sudo apt-get update -y && sudo apt-get upgrade -y
NEVER ATTEMPT TO MODIFY OR ACCESS ANY PART OF THE LINUX SUSYSTEM using windows or any program (e.g. Windows Explorer, Atom).
Windows programs will corrupt the Linux system's code by inserting its garbage, and BAD THINGS WILL HAPPEN!
You should ONLY MODIFY LINUX SUBSYSTEM USING A BASH SHELL INSTANCE if you know what you are doing.
Prior to the next steps, I had installed Jekyll via the method on jekyllrb.com Docs Installing on Windows page. This ruby version and the installed ruby gems must be removed FIRST.
// remove the ruby version installed via jekyllrb.com
$ sudo apt-get remove ruby2.3 ruby2.3-dev build-essential dh-autoreconf
// and a little bit of cleanup
$ sudo apt autoremove
// cleanup rvm source files
$ rvm cleanup all
// remove rvm installation
$ rvm implode
$ gpg ‑‑keyserver hkp://keys.gnupg.net ‑‑recv‑keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
$ sudo apt-get install gnupg2
// download the installation script
// I left the instllation scripts as-is
$ \curl -sSL https://get.rvm.io -o rvm.sh
// edit installation shell script with this
$ less rvm.sh
// run the RVM installation shell script
$ cat rvm.sh | bash -s stable
// set the RVM source path OR exit and restart cmd and start new bash instance
$ source ~/.rvm/scripts/rvm
$ rvm install ruby --default
$ ruby -v
// my ruby version returns 2.4.1
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
$ gem update
$ sudo apt-get install libgemplugin-ruby
$ gem install jekyll bundler
// check the installation
$ jekyll -v
Using the Windows Node.js installer will put node.js and npm in the windows system. We want to use node.js and npm while in the bash linux subsystem.
// enter sudo su mode
$ sudo su
// always good to update before installing
$ apt-get -y update
// install git in the linux subsystem
$ apt-get install git
// this will download the "Recommended" (stable) version 8.9.4 LTS
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
// install the downloaded version of nodejs:
apt-get install -y nodejs
// OR - for the 9.6.1 "Current" version use:
$ curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - apt-get install -y nodejs
// nodejs 9.x needs this as well:
apt-get install -y nodejs
$ gem install bundler
// npm installs only ever work with sudo for me:
$ sudo npm install --global gulp-cli
Why bother with dotfiles on Windows? Dotfiles are awesome and easy to install, thats why! Above is a screenshot of my dotfiles in action. Customization of text colors is nice, but I love aliases. Instead of typing out comands like "git status" a million times, I just type "gs" for the same command. These dotfiles are based off of github user paulirish's.
Some of my commonly used aliases include:
$ cd ~
// clone the git repo
$ git clone https://github.com/wdzajicek/dotfiles.git
// cd to downloaded repo
$ cd dotfiles
// view the file using vim:
$ vim .bash_profile
// do NOT enter insert mode to copy text
// ignore the first lines of code:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
export PATH="/usr/local/opt/gettext/bin:$PATH"
// this is the code we want:
for file in ~/.{path,bash_prompt,aliases,functions}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;
// ignore the code after
// back out one dir level (back to Home)
$ cd ..
// open your actual .bash_profile in vim
$ vim .bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
export PATH="/usr/local/opt/gettext/bin:$PATH"
for file in ~/.{path,bash_prompt,aliases,functions}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
// you may already be home:
$ cd ~
// go back into downloaded dotfiles repo
$ cd dotfiles
// use the cp command to copy the files and place them up one dir level (in your Home dir)
$ cp .aliases ../.aliases
$ cp .functions ../.functions
$ cp .bash_prompt ../.bash_prompt