Enable write support for NTFS on OS X Mavericks

Retrieve the UUID of the drive you want to write on

1
2
$ diskutil info /Volumes/YourDriveName | grep UUID
Volume UUID: 22F1DF1C-AFDE-B507-A15B-FC9296BB2E2B

Edit the file /etc/fstab

1
$ sudo vi /etc/fstab

Add the following content

1
UUID=22F1DF1C-AFDE-B507-A15B-FC9296BB2E2B none ntfs rw,auto,nobrowse

Unmount the drive, and then remount. It should now writable.

Important NOTE

1
It is also important that the HD has been safely removed, since NTFS contains a flag to notice if the disk was safely removed or not, not allowing to mount it in write mode with the native OSX driver (something similar happens under Linux). In case it happens you just need to plug it into a windows PC and safely remove the HD (so it cleans that flag).

Script download

By neburim

Reference:

Enable write support for NTFS on macOS Sierra

Find your disk name

1
2
3
$ ls -l /Volumes/
drwxr-xr-x 1 jslim staff 4096 Nov 7 12:33 'New Volume'/
lrwxr-xr-x 1 root wheel 1 Nov 7 10:05 'Macintosh HD' -> /

So in this case my external hard disk name is New Volume

Edit/Create the file /etc/fstab

1
$ sudo vim /etc/fstab

Add the following content

1
LABEL=New\040Volume none ntfs rw,auto,nobrowse

\040 is represent a character.

Now unmount it, and plug it back. It will appear in /Volume directory

Reference:

Missing Air Drop in Mountain Lion

Open up terminal

1
2
3
$ defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1
# restart finder
$ killall Finder
Reference:

Delete provisioning profile on XCode 5

Open up terminal

1
2
3
4
5
6
$ cd ~/Library/MobileDevice/Provisioning\ Profiles
$ ls -la
total 120K
-rw-r--r-- 1 user group 13K Oct 22 13:37 13C42BED-0555-4684-A905-5547B2293D46.mobileprovision
-rw-r--r-- 1 user group 7.7K Oct 19 12:53 3CA5CC4A-E995-41D6-BA54-66A3AFB4061F.mobileprovision
-rw-r--r-- 1 user group 7.4K Sep 11 10:57 F4BCC928-32B7-42F8-85EB-EA47ADE86C14.mobileprovision

See which one you want to delete (when you added the profile)

1
$ rm 13C42BED-0555-4684-A905-5547B2293D46.mobileprovision
Reference:

Install command line tools in Xcode 5 & Mavericks

1
$ xcode-select --install
Reference:

Configure virtual host in XAMPP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<VirtualHost web-local.mysite.com:80> // use <ServerName>:80 instead of *:80
ServerAdmin webmaster@dummy-host.example.com
ServerName web-local.mysite.com
ServerAlias web-local.mysite.com
DocumentRoot "/Users/username/public_html/mysite"
<Directory "/Users/username/public_html/mysite/">
DirectoryIndex index.php
Options All
AllowOverride All
Order allow,deny
allow from all
Require all granted // this is required
</Directory>
ErrorLog "logs/web-local.mysite.com-error_log"
CustomLog "logs/web-local.mysite.com-access_log" common
</VirtualHost>
Reference:

grep with color

Add the following content to ~/.profile

1
2
export GREP_OPTIONS='--color=always'
export GREP_COLOR='1;37;41' # you can set the color here
Reference:

Terminal history not keeping

This is because of permission issue

1
2
$ ls -l ~/.bash_history 
-rw------- 1 root group 164 Apr 15 11:00 /Users/username/.bash_history

Simply change the owner

1
2
3
$ sudo chown username ~/.bash_history
$ ls -l ~/.bash_history
-rw------- 1 username group 164 Apr 15 11:00 /Users/username/.bash_history
Reference:

replace pattern with sed

I have already mention this in Linux section, but there is a small difference here. The command below will produce error

1
$ sed -i "s/reload('#\(\w\+\)#&#\(\w\+\)#')/href='#\1#\&#\2#';/" /path/to/file

Output

1
sed: 1: "AbcFile.c": invalid command code A

Here you have to add -e option for OS X, e.g.

1
$ sed -ie "s/reload('#\(\w\+\)#&#\(\w\+\)#')/href='#\1#\&#\2#';/" /path/to/file

NOTE: You can either use -ie or -i -e

Reference:

Batch resize image

1
$ sips -Z 1024 *.png

1024 is refer to width, the height will adjusted according to ratio

Reference:

Compress and split files

1
2
3
4
5
6
$ tar -zcvf file.tar.gz file/*
$ split -b 3500m file.tar.gz file.tar.gz.
$ ls -l
-rw-r--r-- 1 js staff 6.5G Aug 10 21:20 file.tar.gz
-rw-r--r-- 1 js staff 3.5G Aug 10 21:25 file.tar.gz.aa
-rw-r--r-- 1 js staff 3.1G Aug 10 21:29 file.tar.gz.ab
Reference:

Search and replace multiple files

1
$ grep -R -l "special keyword" * | xargs sed -i "" 's/special keyword/new keyword/'
  • grep -R -l "special keyword" * - retrive all files that contains “special keyword”
  • sed -i "" 's/special keyword/new keyword/' - replace “special keyword” with “new keyword”
Reference:

Mission control not working

Restart it

1
$ osascript -e 'quit application "Dock"'
Reference:

Convert heic to jpg

1
2
$ brew install imagemagick
$ magick mogrify -monitor -format jpg *.HEIC
Reference:

Create Catalina iso file

1
2
3
4
5
6
7
$ hdiutil create -o /tmp/Catalina -size 8500m -volname Catalina -layout SPUD -fs HFS+J
$ hdiutil attach /tmp/Catalina.dmg -noverify -mountpoint /Volumes/Catalina
$ diskutil eraseDisk JHFS+ Catalina disk3
$ sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/Catalina –-nointeraction
$ hdiutil detach /volumes/Install\ macOS\ Catalina
$ hdiutil convert /tmp/Catalina.dmg -format UDTO -o ~/Desktop/Catalina.cdr
$ mv ~/Desktop/Catalina.cdr ~/Desktop/Catalina.iso

Download create-catalina-iso.sh

Reference:

PhpStorm (ideavim) / VScode / Cursor cursor not moving when holding on j k h l

  1. Find the app’s unique id
    1
    osascript -e 'id of app "Cursor"'
  2. Then
    1
    2
    3
    defaults write com.todesktop.230313mzl4w4u92 ApplePressAndHoldEnabled -bool false
    defaults write com.jetbrains.PhpStorm ApplePressAndHoldEnabled -bool false
    defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
  3. Restart the application
Reference: