Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac now defaults to using port 5000 #173

Open
schneems opened this issue Mar 6, 2023 · 0 comments
Open

Mac now defaults to using port 5000 #173

schneems opened this issue Mar 6, 2023 · 0 comments

Comments

@schneems
Copy link

schneems commented Mar 6, 2023

Problem

Recent macs now default to using port 5000 for "control center" https://nono.ma/port-5000-used-by-control-center-in-macos-controlce.

If you try to boot foreman with default values you now get an error:

12:20:05 PM web.1 |  [36252] Puma starting in cluster mode...
12:20:05 PM web.1 |  [36252] * Puma version: 6.1.1 (ruby 3.1.3-p185) ("The Way Up")
12:20:05 PM web.1 |  [36252] *  Min threads: 5
12:20:05 PM web.1 |  [36252] *  Max threads: 5
12:20:05 PM web.1 |  [36252] *  Environment: development
12:20:05 PM web.1 |  [36252] *   Master PID: 36252
12:20:05 PM web.1 |  [36252] *      Workers: 2
12:20:05 PM web.1 |  [36252] *     Restarts: (✔) hot (✖) phased
12:20:05 PM web.1 |  [36252] * Preloading application
12:20:06 PM web.1 |  bundler: failed to load command: puma (/Users/rschneeman/.gem/ruby/3.1.3/bin/puma)
12:20:06 PM web.1 |  /Users/rschneeman/.gem/ruby/3.1.3/gems/puma-6.1.1/lib/puma/binder.rb:335:in `initialize': Address already in use - bind(2) for "0.0.0.0" port 5000 (Errno::EADDRINUSE)

In a perfect world there would be some sort of an open way to register port usage by different applications, or at least some minimal spec that says "these port ranges are reserved for user control" but we don't live in that world.

It's frustrating that Apple did this, and I wish I had more confidence that they wouldn't do it again or even confirmation/acknowledgement that they messed up and understand why this is a problem.

Barring any of that, let's talk things we can control. Here's some brainstorming:

Possible ways forward

Change to a different value

Assuming this is a once off thing, change it to 5001 or 6000 or some other static number by default.

Scan for a valid value

Instead of being stuck on a static value, start at one number and scan to see if it's blocked, continue until we find a good value. Downside would be: now every time you run the application the port number might be different. We could perhaps introduce a flag like: --open which would trigger an OS specific command line open command. On mac it would be open localhost:<port> for example.

One downside is security: Calling open on the CLI requires care as any unescaped values can be easily exploited.

Force a value

Instead of defaulting or scanning, we could err if --port is not set. I like this option the least.

Do nothing

We could do nothing and the foreman command would just not work by default on mac.

Something else

Any other options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant