On Linux there’s simple
truncate command to achieve that. Truncate however is not available on OS X by default. Here’s a quick tutorial how to install and use
truncate using MacPorts.
- Install MacPorts
- In Terminal run
sudo port install truncateand wait for process to end. You’ll be asked to enter an admin password to install command. It won’t print any characters, just hit Enter after you enter the password.
- Happy truncating
truncate in Terminal to see manual.
Mine looked like this:
$ truncate truncate v0.3, (C) by [ANTISPAM: email removed] Usage: file [new size] If new size is omitted, the file will be truncated to 0 bytes.
Truncate MAMP PHP error log to zero length
Hope it helps.