macOS_SETUP.md
December 22, 2024 · View on GitHub
Prerequisites
-
macOS (latest recommended)
-
Homebrew: Install Homebrew
-
Git (preinstalled)
-
Node.js (18.x) and npm: Install via Homebrew or from Node.js official site
-
Python and Build Tools (for mediasoup):
brew install python3 xcode-select --installThe
xcode-select --installcommand installs command line tools (including a compiler) necessary for native module compilation. -
Optional: Nginx for local reverse proxy.
Steps
-
Install Node.js 18.x:
brew install node@18 -
Clone the MediaSFU Repository:
git clone https://github.com/MediaSFU/MediaSFUOpen cd MediaSFUOpen -
Remove existing modules and install dependencies:
rm -rf node_modules package-lock.json npm install -
Local SSL Certificates:
Generate self-signed SSL certificates for
localhost. This is required for WebRTC and HTTPS. You can create a bash script or useopensslcommands to generate the certificates. To create a script, create a file namedlocalssl.sh(in the root directory) with the following content:openssl genrsa -out local.com.key 2048 openssl req -new -x509 -key local.com.key -out local.com.pem -days 365 \ -subj "/C=US/ST=State/L=City/O=Organization/OU=OrgUnit/CN=localhost" mkdir -p ssl mv local.com.key local.com.pem ssl/You may need to change the file permissions to make the script executable:
chmod +x localssl.shRun the script:
./localssl.shThe script generates
local.com.keyandlocal.com.pemfiles in thessldirectory. These files are used for HTTPS. -
Running MediaSFU on localhost:
npm run dev:localAccess:
https://localhost:3000/meeting/start
Accept the self-signed certificate warning. -
Firewall and Ports on macOS:
By default, macOS’s built-in firewall does not block outbound connections. To enable and configure the firewall:
- Enable macOS Firewall:
System Settings > Network & Internet > Firewall > Turn On Firewall - Allow Incoming Connections for Node.js:
When you first runnpm start, macOS might prompt to allow incoming connections. Click Allow.
If you use third-party firewall tools, ensure ports
3000,40000-49999are allowed for both TCP and UDP as needed. For local development, this is often not mandatory unless you specifically enabled strict firewall rules. - Enable macOS Firewall:
-
Optional: Using Nginx Locally:
brew install nginxConfigure Nginx as desired (similar to the Ubuntu instructions but adjust paths).
-
Safe Origins for Socket.IO:
In
index_localhost.jsorindex.js:const safeOrigins = ['https://localhost:3000']; -
PM2 for Process Management (Optional):
npm install pm2 -g pm2 start index_localhost.js