Installation cheatsheet

Install chruby:

which ruby # Old ruby

brew install chruby
brew info chruby # Check its information

# https://github.com/postmodern/chruby/wiki/Ruby
brew install automake bison openssl readline libyaml gdbm libffi

brew tap raggi/ale
# macOS users must update their OpenSSL CA cert bundle
# https://github.com/raggi/openssl-osx-ca#readme
brew install openssl-osx-ca

brew services start openssl-osx-ca

# Caveat: restart raggi/ale/openssl-osx-ca after an upgrade
brew services restart raggi/ale/openssl-osx-ca

Install Ruby:

curl --remote-name https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0.tar.xz
tar -xJvf ruby-3.2.0.tar.xz
cd ruby-3.2.0
./configure --prefix="$HOME/.rubies/ruby-3.2.0" --with-opt-dir="$(brew --prefix openssl):$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm):$(brew --prefix libffi)"
make -j4
make install

Switch Ruby:

chruby # List ruby
chruby 3.2.0 # Select ruby

Update gem:

gem update --system 3.4.13

Install Imagemagick:

brew install imagemagick

Configure:

# To solve openssl ssl error:
export SSL_CERT_DIR=/Users/halin/mambaforge/ssl
export SSL_CERT_FILE=/Users/halin/mambaforge/ssl/cacert.pem

# Set repository
export PAGES_REPO_NWO="lin-ht/lin-ht.github.io"

Personal github page set up:

cd <path-to-the-repo-lin-ht.github.io>

# deploy the page
bin/deploy --user

# start local server
bundle install
bundle exec jekyll serve

To resolve baseurl error while deployed on github, use empty string baseurl: '' in _config.yml.

New terminal configuration cheatsheet

When open a new terminal, remember to chruby:

chruby # List ruby
chruby 3.2.0 # Switch ruby
ruby -v # check the current ruby version

# configuration
export SSL_CERT_DIR=/Users/halin/mambaforge/ssl
export SSL_CERT_FILE=/Users/halin/mambaforge/ssl/cacert.pem
export PAGES_REPO_NWO="lin-ht/lin-ht.github.io"

bundle exec jekyll serve

Command cheatsheet

git diff
git add --all 
git commit -m "Post update" 
git push -u origin customized 
bin/deploy --user
bundle exec jekyll serve --lsi

git commands

git branch # List local branches 
git branch -r # List remote branches 
git branch -a # List local and remote branches

git checkout my-branch-name

Trouble shooting of pushing updates onto origin (reference):

If it is asking you for a username and password, your origin remote is pointing at the HTTPS URL rather than the SSH URL. Change it to ssh.

For example, a GitHub project like Git will have an HTTPS URL and an SSH one:

# https
https://github.com/<Username>/<Project>.git
# ssh
git@github.com:<Username>/<Project>.git

You can change the url from HTTPS to SSH by:

git remote set-url origin git@github.com:<Username>/<Project>.git

References