Skip to content

Instantly share code, notes, and snippets.

@xkeshav
Forked from zymr-keshav/Ubuntu to macOS.md
Last active April 22, 2022 06:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xkeshav/43384db135d706169465f9056387f12e to your computer and use it in GitHub Desktop.
Save xkeshav/43384db135d706169465f9056387f12e to your computer and use it in GitHub Desktop.
useful tweaks and tip while switching from ubuntu to macOS x

Ubuntu to Mac OS.

following are my finding while switching from ubuntu to macOS, first I describe the issue and what is the alternative in the mac OS before moving forward, let's know the version name by their number denoated as OS X

version number version name
10.10 "Yosemite"
10.11 "EI Captian"
10.12 "Sierra"
10.13 "High Sierra"
10.14 "Mojave"
10.15 "Catalina"
11 "Big Sur"

so whenever you search specific in google for your mac, prepend query with os x

Keybaord symbol list

can be visible here --> apple icon > System Preferences > Keyboard > Modifier Keys

= Command
= Shift
= Option (a.k.a. Alt)
= Ctrl
= Esc
↩︎ = Return
= Delete (a.k.a. Backspace)

command cmd key means the key

Keyboard shortcuts

+ + i => chrome developer tools
+ + J => chrome developer tools console
+ + h => Home
+ + d => Desktop
+ + a => Application
+ + u => Utilities
+ + . => Toggle hidden files
+ , => Open Settings of any item/ panel
+ + t => Add folder to sidebar (bookmark)
+ + f => Maximize current active window

25 Tips for mac OS

  1. You can not create new file from context menu but can create new folder only

    alternative: use touch filename from terminal

  2. No utility to lock the screen

    alternative:

    • Navigate to  icon --> System Prefrences --> Security & Privacy --> General --> Check Require Password immediately after sleep or screen saver starts
    • hit shift + ctrl + power hold them down for two seconds, revoke by Spacebar

    Note: in the latest mac OS (10.13 or later) the keyboard shortcut is cmd + shift + q

  3. No way to see hidden files in a folder

    alternative: open terminal and run defaults write com.apple.Finder AppleShowAllFiles true and than killall Finder
    keyboard shortcut: + shift + .

  4. No way to see file systems

alternative:

  1. go to finder ( which is equivalent to explorer in windows and nautilus in Ubuntu)

  2. hit + shift + h ==> opens Home folder ( in Finder )

  3. hit + shift + g ==> write location name

  4. Open in Terminal directly within folder utility in context menu is missing alternative:  icon --> System Preferences --> Keyboard --> Shortcuts --> Services --> Enable "New Terminal at Folder"

    to check this, suppose we have to open /opt/alpha/beta folder in terminal then go back to the parent folder (alpha), select the relevant folder (beta), right click (context menu) --> Services --> there you see Open Folder in Terminal

  5. brew instead of apt-get

    install brew using below command in terminal /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Reference: http://brew.sh

  6. Unable to keep project open in sublime text while we close all the files.

    alternative: use shift + q to close sublime completely.

  7. No shortcut to open terminal

    alternative: + spacebar and write Terminal ( minimize and right click on icon from dock and check Options > Keep in Dock)

    now you will have terminal in dock always ( just like taskbar in windows and favorite in ubuntu)

  8. Title of tab in terminal ( shortcut + i ) and write tab title ; but no way to close that panel using keyboard

  9. no window maximize, if you click on maximize, it will span over the screen and hide the menu and double tab on window will adjust according to screen width

  10. window top bar can not be adjusted within open window

  11. git installed but no autocomplete feature in terminal

alternative: - install curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

- add below content in __~/.bash_profile__ file
     if [ -f ~/.git-completion.bash ]; then
      . ~/.git-completion.bash
     fi

note: in latest mac OS (catalina or later) default shell is zsh which have inbuild auto complete feature

  1. mouse scroll is reverse in mac OS, which cause trouble for the ubuntu and windows user

    • Navigate to (Apple icon) -> System Prefrences > Mouse > Uncheck Scoll Direction : Natural
  2. set function keys ( F1 F2 ) as normal

    • Navigate to Apple icon  > System Prefrences > Keyboards > (last option) check F1.F2, etc.. keys as standard keys
  3. remove siri ( not useful on office laptop )

  • Navigate to System Prefrences ( Apple icon) > Siri > Uncheck Enable Siri on right side panel
  1. backspace is fn + delete

  2. remove Notification of stocks -Navigate to Apple icon > System Prefrences > Extensions > Today > uncheck Stock

  3. rename any file --> select File and Press Enter (return)

  4. To open settings of an application, ess + , on the open window of that application

  5. make link for sublime so that it can be opened from terminal by hit subl , for that run below command

sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

now write subl . in terminal from the location of peoject folder to open project in sublime.

  1. Remove entry from context menu

 icon --> System Preferences --> Keyboard --> Shortcuts --> Services > text > uncheck the un necesray item from context menu such as "Add to iTunes as a Spken Track"

  1. install XtraFinder for adding copy move and other feature in folder/file context menu

  2. brew install coreutils so that you can use linux command such as shuf, date but with prefix g ; so date is gdate and shuf -is gshuf

  3. colorful terminal and git branch name in terminal

write following content in ~/.bashrc file

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

RED="\[\033[0;31m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[1;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"

export PS1="${GREEN}\u@${LIGHT_GRAY}\h:${LIGHT_RED}\w${LIGHT_GREEN}\$(parse_git_branch)${BLUE} $ "

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
  1. when you click on a zip file and select Open; it will extract the zip into same folder.

mysql installation in mac os

download and install ; it will set default password which will be displayed after succesfull installtion completion; note down now first make symbolic link for mysql to run from terminal

echo 'export PATH="$PATH:/usr/local/mysql/bin"' >> ~/.profile
source ~/.profile

$: mysql -u root -p

change default password

mysql>

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password'); Query OK, 0 rows affected, 1 warning

exit;

now you can access with your password

. mysql start stop restart

sudo /usr/local/mysql/support-files/mysql.server start/stop/restart

Or you can set alias to mysql alias mysql=/usr/local/mysql/bin/mysql and then run below query $: mysql -u root -p Enter Password:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment