Skip to main content

MAC OS Tricks and Shortcuts


I am learning about Mac OS, so thought to compile all the stuff I learn in this post.

How to run *.sh scripts in mac?



*.sh files are opened in a text editor by default, but to execute a script in Terminal when you click it, you have to do the following:
  • Change the extension of the script to *.command (i.e. file.sh -> file.command) 
  • Make the file executable by running the following command: chmod +x file.command 

How to capture the screen in mac and save it as an image (on the desktop)? 


  • Command+Shift+3: Captures the full screen (or screens if multiple monitors). 
  • Command+Shift+4: Let you select the area on the screen to be captured. 
  • Command+Shift+4, then space bar and then select a window: Captures the screenshot of the selected window. 
In order to capture the screen in mac and copy it to the clipboard for the use in another program, use the above keys in addition to the “Control” key.

How to format your pen drive to copy large files from Mac to Windows?


You might have come across the problem of copying large volume files into pen drives formatted in Windows. This can be overcome by formatting your pen drive under Mac. Please follow the following steps (note that this might not work with older versions of Windows and Macs):
  1. Launch Disk Utility (/Applications/Utilities/). 
  2. Connect the drive you wish to format for dual compatibility to the Mac. 
  3. Click the drive name on the left side list in “Disk Utility”, and then click the “Erase” tab. 
  4. Click the pulldown menu alongside “Format” and select “exFAT”. 
  5. Optionally, give the drive a name. 
  6. Click the “Erase” button to format the drive for Mac & Windows PC compatibility. 

How to convert a colour pdf into black & white or gray?

Open the pdf file in Preview. Now, Click “File” -> “Duplicate” (This will open the document in a new window) -> Goto “File” -> “Save” -> In “Quartz Filter” select “Black & White” or “Gray Tone” depending on the need and save the file.

Mac Text delete shortcuts 

  • Deleting text in front of the cursor with the regular Delete key can be done by holding down the Function, or fn key while pressing it. 
  • You can also do this by pressing Control + D
  • You can delete the entire word behind the cursor by pressing Control + Delete or Option + Delete
  • You can delete the entire line of text or paragraph behind the cursor by pressing Command + Delete.

How to change where the screenshots are saved in Mac:

defaults write com.apple.screencapture location ~/Pictures/ killall SystemUIServer

Mac OSX EI Capitan clean installation - Mashable

How to initiate a VNC session in Mac:

Open the terminal and enter the following
open vnc://192.168.1.1

or from finder,
Go -> Connect to server / Command+k
Type in the same "vnc://..." as above (without the "open" part). You can save connection shortcuts here also.

How to create a .bashrc file in Mac

Create a .bashrc file in your home directory.
Add the following to your ~/.profile or ~/.bash_profile file
[pre class="brush:bash"]if [ -f ~/.bashrc ]; then . ~/.bashrc; fi[/pre]
Change the permission of your ~/.profile or ~/.bash_profile file as below
[pre class="brush:bash"]chmod 700 ~/.profile[/pre]
sourcs: https://superuser.com/questions/147043/where-to-find-the-bashrc-file-on-mac-os-x-snow-leopard-and-lion

How to Increase the Magic Mouse Pointer Speed

Firstly, type the following command to check the current setting (mostly you will find 3)[pre class="brush:bash"]defaults read -g com.apple.mouse.scaling[/pre]
Now, change the speed by entering the following command with the speed you want.[pre class="brush:bash"]defaults write -g com.apple.mouse.scalling 5.0[/pre]

Source: https://discussions.apple.com/thread/6621331?start=0&tstart=0

How to install GUI applications using command line

Homebrew Cask extends Homebrew and brings its elegance, simplicity, and speed to the installation and management of GUI macOS applications such as Atom and Google Chrome.Some examples
[pre class="brush:bash"]
brew cask install virtualbox
brew cask install vagrant
brew cask install atom[/pre]

Source: https://github.com/Homebrew/homebrew-cask


You may also interested in reading:

Comments