I found that this was actually not a very good idea nor did it make my system faster. This will disable your computer’s ability to use virtual memory.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
To turn it back on
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
However, note the command-line tool “purge” (just one word) to free the inactive memory on your system.