All the tutorials online seem to be missing something. I was able to put them together. The following requires you being able to use wget and php commands inside your terminal. You can use svn in place of wget.
Download the i18n files from: http://i18n.svn.wordpress.org/tools/trunk/
You can do this using wget by running the following command in your terminal:
wget -r -np -R "index.html*" http://i18n.svn.wordpress.org/tools/trunk/
Download the WordPress development trunk: http://develop.svn.wordpress.org/trunk/
Again you can do this using wget by running the following command in your terminal:
wget -r -np -R "index.html*" http://develop.svn.wordpress.org/trunk/
Navigate the contents of the development trunk folder which you downloaded in Step 2 and copy the pomo
folder located in trunk/src/wp-includes/
and paste it inside the i18n folder which you downloaded in Step 1, located in /tools/i18n
At the end your i18n folder should have both the makepot.php
file as well as the pomo
folder and the other files that were already present inside the i18n folder.
Now you just need to run the command so that your pot file can be generated.
If you want to generate a plugin pot file, run(while inside i18n folder):
php makepot.php wp-plugin /path/to/your/plugin pluginname.pot
If you want to generate a theme pot file, run(while inside i18n folder):
php makepot.php wp-theme /path/to/your/theme themename.pot
You can go further by creating a bash script to always run the command and move the i18n folder out of your working directory.
Note: After running command you might get the message sh: 1: msguniq: not found
inside your terminal. That just means it worked :)
I actually haven't used this script in years...I currently just use Loco Translate plugin: https://wordpress.org/plugins/loco-translate/ to generate the .pot file for me when I change or add strings