Unremovable partition after trying to install ubuntu
If you are using El Capitan (OS X 10.11), then the document you are referencing will not work as expected.

As for your question. The command below will remove the Linux Swap partition.

sudo diskutil erasevolume "Free Space" "" /dev/disk0s3


The next command expands your Macintosh HD volume to contain the free space.

sudo diskutil resizevolume /dev/disk0s2 R



  Note: I am not sure if the prefix sudo is necessary. (But, it will do no harm if you include the sudo)