Lance Cleveland

MacOS Monterey Node Port 9000 Refused

I’ve been working on a React App for months that connects on localhost port 9000. Recently the app stopped working after an upgrade to Monterey. Turns out the upgrade also required a number of services to be re-installed via brew. One of those services, php-fpm, is now taking over port 9000 automatically on startup despite not having explicitly set the updated PHP version to run at start.

As such, opening http://localhost:9000/ on the browser was routing to PHP apps and not the node app I was looking for.

MacOS Listing Port Usage

The first step to finding what other services might be fighting with the node app is to run the lsof command.

sudo lsof -i :9000

The :9000 should be replaced with whichever port you are investigating. Port 9000 is the default for most node servers.

In my case the results looked like this:

This tells us that php-fpm will first answer any port 9000 queries on IPV4 localhost.

Node server has been relegated to only answer port 9000 on IPV6.

The node server on IPV6 can be verified by pointing the browser to http://[::1]:9000/ and connecting to the app.

[::1] is the IPV6 syntax for localhost.

Listing Homebrew Services

To stop the php-fpm service it needs to be managed via brew since that is where I started the service from in the first place. The service php-fpm does not exist, so what is calling it? Let’s check brew services…

brew services list

Turns out is is the php@7.4 service causing the issue.

Stopping Brew Services

Now that we know which service is fighting with node server we can stop it.

brew services stop php@7.4

That stops php-fpm from intercepting port 9000 traffic on localhost and the original http://localhost:9000 access I was running previously is now back in action.

Here’s What’s Happening in That Viral Oil Well Bitcoin Mining Video

A video of a bitcoin mining rig on an oil well got thousands of retweets and replies, criticizing it for destroying the planet—but it’s not that simple.
— Read on

Radiative Cooling and Solar Heating From One System – No Electricity Needed

Radiative Cooling and Solar Heating From One System – No Electricity Needed
— Read on

Quantum Particles, Magnetic Fields, and Migratory Birds

An interesting article on Science Alert about how cellular biology is influenced by magnetic fields. This can trigger cellular reactions that, in theory, can influence biological behavior. It is a theory in how living things, like migratory birds, can detect Earth’s magnetic fields and navigate using them.

Cleaning Up WordPress – Large wp_options.idb

Did your tiny AWS Bitnami WordPress server run out of disk space? The culprit may be unoptimized data tables in MySQL. Finding a 4.9GB wp_options.idb file on your server is not as uncommon as you may think. What makes it surprising is when you look at your wp_options entries and discover there are only 300 rows in that table with limited text in the option_value column.

Thankfully there is an easy fix as long as you can get enough disk space to manage the task. Start by looking for any log files or other files you are CERTAIN you don’t need so you can shut down web, php, and mysql services.

Finding Large Files

# sudo find / -xdev -type f -size +50M -print | sudo xargs ls -lh | sudo sort -k5,5 -h -r

This command finds all files on the drive over 50M in size.

Look for specific MySQL raw data files (wp_options.idb for example) in that list. Remember the table name for later.

Stopping System Services

Stop the services. On an AWS Bitnami WP server they have their own special control scripts in place of the standard Linux services library.

bitnami@ip-172-31-87-127:/opt/bitnami/mysql$ sudo /opt/bitnami/ stop mysql

usage: /opt/bitnami/ help
       /opt/bitnami/ (start|stop|restart|status)
       /opt/bitnami/ (start|stop|restart|status) mysql
       /opt/bitnami/ (start|stop|restart|status) php-fpm
       /opt/bitnami/ (start|stop|restart|status) apache

help       - this screen
start      - start the service(s)
stop       - stop  the service(s)
restart    - restart or start the service(s)
status     - show the status of the service(s)

Stop all the services, then start MySQL only.

Cleaning Up MySQL

If you are doing system admin commands you should know how to find your data access credentials in the wp-config.php file. No need to go into that here. Find the credentials and login to MySQL.

No OPTIMIZE that table (and any others that you suspect have unusually large .idb files).


That’s it. One simple command may easily recover 4.9GB of disk space , making a 4.9GB file on a 9GB drive get back to a more reasonable 10MB.

Why WordPress core or cron jobs are not doing this on a regular basis is a question for another day…

%d bloggers like this: