Switching to Mac from Windows or Linux: essential guide

Switching to Mac from Windows or Linux: essential guide

How to struggle less with Mac when switching?

Mac configuration

If you're coming from Windows and/or Linux background getting used to Mac OS could be difficult. I use Mac at work but at home I use Ubuntu (for work) and Windows (for gaming and video editing).

It wasn't easy to get used to Mac. After some trial and error, I managed to create a more or less similar experiences for all three operating systems.

I don't remember what adjustment I had to make with Windows and Ubuntu (those are probably for different blog posts anyway), but my memories about required adjustments for Mac are quite fresh.

In this short guide (which I am intending to update as I go) I will help you to create a more familiar experience with Mac OS.

Keyboard and mouse

Let's start with very basic things. You must have noticed that Mac has a different keyboard. In my case, I connected an external non-Mac keyboard to Mac.

The other problematic thing is the mouse acceleration which might be good with trackpad, but absolutely horrible with an external mouse.

Below is the list of things I had to do to make it all usable.

Configure keyboard

  • Reassign external keyboard keys - swap control (win on external board) and command buttons

  • Configure win+shift+s shortcut for screenshot

  • Configure contrl+win+left/right to switch between spaces

Add new shortcuts to lock the computer and to tile windows left and/or right

  • Open System Preferences

  • Go to Keyboard Preference Pane

  • Go to Shortcuts tab

  • Select "App Shortcuts"

  • Click "+"

  • Select "All Applications", "Lock Screen" and type shortcut (win+l) on external keyboard

  • Similarly add shortcuts to tile window left/right (win+left/right)

Configure Trackpad

  • Allow selecting text with trackpad (double tap selection) -> select "Enable dragging" -> "without drag lock"

tap2.jpg

  • Enable tap on touchpad

    • System Preference -> trackpad -> tap to click

Disable mouse acceleration

  • This will make mouse to behave more like Windows/Linux

  • Open terminal and run following command:

defaults write .GlobalPreferences com.apple.mouse.scaling -1

Configure terminal

While Mac OS does have Bash out of the box, it is still far from a good state, especially comparing to very colourful and user-friendly Ubuntu Bash. Let's change that!

  • Change default terminal to Bash

  • Add this to .bashrc file:

 # for Brew
export PATH="/opt/homebrew/bin:$PATH"

# Hides the default login message
export BASH_SILENCE_DEPRECATION_WARNING=1

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# Enable colors in bash
export CLICOLOR=1
export LSCOLORS=GxBxCxDxexegedabagaced

# get current git branch
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

# if working directory is too dark change [01;34 to [01;36 
# find username@hostname:$ 
export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[0;32m\]\$(parse_git_branch)\[\033[00m\]\$ "

 # This turns on git autocomplete in terminal
[ -f /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash ] \
    && . /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash

Apps to install/configure

Unlike Linux lots of helpful software is missing and has to be downloaded elsewhere. Below is the list of absolutely essential apps to have

    "vim.useSystemClipboard": true,
    "vim.handleKeys": {
        "<D-d>": false
    }

Add SSH-AGENT to startup

Many tutorials for using ssh-agent recommend running/adding to .bashrc this command:

eval $(ssh-agent

It indeed starts ssh-agent, but would do it every time you start your terminal. At the end of the day, there may be dozens or even hundreds instances of ssh-agent running.

There's a simple trick to avoid that. Create a file with a name ssh-agent.plist in the /Library/LaunchDaemons folder (will require route access) with the following content:

<?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>ssh-agent</string>

    <key>ProgramArguments</key>
    <array>
        <string>eval</string>
        <string>$(ssh-agent)</string>
    </array>
    </array>

    <key>KeepAlive</key>
    <true/>

</dict>
</plist>

Now ssh-agent will start only once on boot!

Other

  • Remember to use control+space instead of win button

  • Optionally enable zoom in Accessibilities (control + scroll in mac keyboard, win + scrool on external)

  • Keyboard differences explained: oreilly.com/library/view/switching-to-the/9..

  • Install tinkertool to be able to change fonts

Finally

I hope this was a helpful guide. Switching from Windows to Mac may be a bit challenging, but after some time working with Mac can be a nice experience. Of course, it is not as gamer-friendly as Windows and not as power user-friendly as Ubuntu, but it does the job and looks pretty.

Please comment if you think it should be amended or updated.

PS

I hope you enjoy my blog. Did you know that I have YouTube channel as well? On this channel I explain:

  1. Developers how to write cleaner and more testable code. TDD, Clean Code, XP, Agile, these sorts of things.

  2. SDET and TA Engineers - how to create efficient automated testing. Test automation, test strategy, DevOps.

  3. Junior developers - the fundamentals they need to know to build a successful career. Data Structures and Algorithms, career progression and interviewing tips.

If it sounds interesting - please subscribe here: youtube.com/channel/UCkJRvCK2-l2gCuPT9-HUG7A