Skip to content

Configurations for tools I use every day.

Notifications You must be signed in to change notification settings

hamsternik/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

~/.dotfiles πŸ’»

Hi there πŸ‘‹

My macOS Daily Apps

Before clone

The basic case – your Macbook is new and so empty. And you need to settle down all basic programs, tools, configs, etc to configure as it should be actually.

First, install the Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Visit the official website if there are any errors occures with the curl command or bash script.

Second, deal with SSH keys before clone the dotfiles repo. Copy this into the ~/.ssh/config file:

Host *
    AddKeysToAgent yes
    IgnoreUnknown UseKeychain
    UseKeychain yes
Host github.com*
    User git
    HostName github.com
    IdentityFile ~/.ssh/github-hamsternik
Host bitbucket.org
    User git
    HostName bitbucket.org
    IdentityFile ~/.ssh/bitbucket-hamsternik

Generate new local ssh key for the personal email. Use github-hamsternik key name.

ssh-keygen -t ed25519 -C "[email protected]"

Start ssh-agent in the background:

eval "$(ssh-agent -s)"

Add the ssh private key to the ssh-agent.

For GitHub:

ssh-add ~/.ssh/github-hamsternik

For Bitbucket*:

ssh-add ~/.ssh/bitbucket-hamsternik

Copy the public key into the clipboard.

For GitHub:

pbcopy < ~/.ssh/github-hamsternik.pub

Open your GitHub account settings and add the new generated public key copied into clipboard.

Check out official GitHub doc to address questions about the SSH generation.

Deploy

Clone the repo and jump into it:

git clone --recurse-submodules -j8 [email protected]:hamsternik/dotfiles.git && cd dotfiles

or if you already cloned the repo without extra key for to load submodules, download all of submodules first:

git submodule update --init --recursive

Install config files in the users' root directory. Just FYI – you are using Zsh at this moment. But don't worry, you will migrate to the fish the next turn.

make dotfiles-install

Next you need to settle the only zsh-git-prompt plugin I am using today with Zsh configuration. There are 2 versions of this plugin and my choice (and author's one) is the haskell version, of course. To set it up, first go and download the latest version of the haskell tool stack called stack.

curl -sSL https://get.haskellstack.org/ | sh

Then jump to the git plugin directory and use next commands:

stack setup

Please wait until the setup is finished to install the proper version of the ghci and other tools. Then run:

stack build && stack install

Next come back to the user root directory and cd into .vim/bundle. Run:

git clone [email protected]:VundleVim/Vundle.vim.git

Install all plugins described into the .vimrc config file. Open vim and run PluginInstall. Vundle will handle all the work automatically.

The last step is to install applications and CLI tools via the Homebrew. As you see, I am actively using make so it would be easy to you to run any command to set up the machine "one click".

make brew-install

Misc: Configs

GPG

First, to disable signing your git commits just off the commit.gpgsign option into your git configuration file. That helps to eliminate any commit issues related the older signing.

To be able to commit with commit.gpgsign true setting in your git configuration, you have to set up GPG unique key on the machine. Check more information about signing commits and git configuration on the official GitHub doc page.

To generate new GPG key you should install gnupg command-line tool first. Verify whether you have the app on your machine after full Homebrew settings file installation. Otherwithe use $ brew install gnupg command to install the app first. Then open the terminal. Generate a GPG key pair.

gpg --default-new-key-algo rsa4096 --gen-key

This command is the new way to pass some arguments and omit extra work by-default. The plain version of the command check out at the Generating a new GPG key doc page.

Enter your user-ID information. I am using hamsternik GitHub account username for that. Next, use gh account's email.

For more information about email verification on GitHub check this doc out.

⚠️ After couple attempts to create GPG key with passphrase git does not commit any changes from any public repo. Idk what is the reason. For now I have GPG key with 2 years of expiration date w/o passphrase.

Use the next command to list the long form of the GPG keys for which you have both a public and private key:

gpg --list-secret-keys --keyid-format=long

From the list of GPG keys, copy the long form of the GPG key ID you'd like to use. E.g. in line sec 4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10] the long form of the GPG generated key is 3AA5C34371567BD2 part. Copy that text from the terminal and insert into your .gitconfig file. You can find configuration file by the configs/gitconfig path. Run to copy the public GPG key:

gpg --armor --export CCD4FA8B4F35837031CBFD0E9474253FF8C3327E-EXAMPLE | pbcopy

Paste copied public key on GPG keys page on GitHub.

The last step to do is telling gh to refresh new GPG key(s) locally. Run the command:

gh auth refresh -s read:gpg_key

Troubleshooting.

If you have any questions please refer the official GitHub page.

1/ When commit changes in any git repo the next error provided down below. TODO: figure out what is the reason.

error: gpg failed to sign the data
fatal: failed to write commit object

Fish shell

In 2022 I had switched from macOS default shell 'Zsh' to the brand-new eye-candy fish shell. Before I had Zsh with custom configuration and small set of scripts onboard, but that is all a history right now. The one thing you have to do is to install fish via Homebrew where the brew-install command already did that for you!

There are multiple things that need to be comprehended, but SO so blessed to speed the process up. Here are some answers how to deal with $PATH variables and aliases:

Furthermore, there are some official document pages from fish shell addressing issues:

I am using fisher fish plugin manager to handle all my programming stuff around. See below certain plugins.

LaTeX

My resume has been written using LaTeX to process plain text into representable peace of my experience and career. I am not a big fan of huge MacTex package. Official source says about ~5Gb of data. Big Yikes!

Let's install A Smaller Distribution, Basic TeX. Nowadays basictex brew package will not be installed automatically with the whole Brewfile apps batch.

brew install basictex --cask

I am using latexmk Perl script to automate the assembly process for the cv repo. Check out more about the latexmk documentation. To install latextmk use tlmgr provided in the basictex package:

sudo tlmgr install latexmk

Most of the time the prompt will say you need update tlmgr right after.

sudo tlmgr update --self

That is it. Go to the cv repo and check it out!

Node.js and NVM

Brew officially provide node.js and NVM as node.js versions manager. But unfortunatelly for any kind of shell you have settled you need to make extra steps to run nvm up the right way. To enable NVM for fish you need to export NVM_DIR into your PATH, e.g. $fish_complete_path variable. Another thing I have done to load nvm dynamically on each shell session is to load NVM somehome. I am using nvm.fish plugin for that purpose because it handles all the things around for me.

Fonts

I'm using spaceship-prompt as a default Zsh prompt after a long time trying to customize it on my own. It required zsh to be installed and Powerline Font as well.

Steps to Deploy:

  • download the repo
  • cd to the fonts directory
  • copy fonts to the ~/Library/Fonts directory

True Color Supporting

I switched from the default Terminal.app macOS application to the cross-platform, GPU-accelerated and popular terminal emulator. Say hello, alacritty πŸ‘‹πŸ»

The topmost reason of doing that is that the Terminal.app does not support true colors and I basically can not make my vim so much brilliant as I can do, obviously.

Right now I am using onedark colorscheme paired with the lightline which is veeery sweety yeah!

There is a discussion thread on the Apple forum about 24bit True Color support in macOS Terminal.app. The short answer: NO.

Emacs

The whole Emacs installation & system configuration I got by these links

To install Emacs Client with Doom configuration framework just run these 2 commands and give 3-5 min:

git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.emacs.d
~/.emacs.d/bin/doom install

To launch emacs daemon within every user login create the next file by the pass ~/Library/LaunchAgents/gnu.emacs.daemon.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>gnu.emacs.daemon</string>
  <key>ProgramArguments</key>
  <array>
    <string>/opt/homebrew/bin/emacs</string>
    <string>--daemon</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>ServiceDescription</key>
  <string>GNU Emacs Daemon</string>
</dict>
</plist>

and use launchctl commands to load the script due the startup:

launchctl unload ~/Library/LaunchAgents/gnu.emacs.daemon.plist
launchctl load -w ~/Library/LaunchAgents/gnu.emacs.daemon.plist

[UPD] Both of these commands are deprecated by Apple starting from 10.10. Instead use new bootstrap and bootout commands with appropriate user's UID and service-name:

id -u "Nikita Khomitsevych" # To know current user UID
sudo launchctl bootstrap gui/<user's UID> ~/Library/LaunchAgents/gnu.emacs.daemon.plist # Use `sudo` to get more detailed error

MongoDB

Basically, I am not a cloud engineer, so I really need some space to recall the basic information about i.e. how to run a mongoDB service localy. Here it is!

  • to run MongoDB process
$ brew services start mongodb-community
  • to stop MongoDB as macOS service
$ brew services stop mongodb-community

More info how to install and work with the latest version of MongoDB Community take a look in the documentation page.