Optimizing MacPorts with the fcix.net Mirror
MacPorts is a powerful package manager for macOS, but by default it uses Fastly CDN infrastructure which can be slow for users in the United States. By configuring MacPorts to use the fcix.net mirror, you can significantly improve download speeds.
This guide covers the three configuration files needed to optimize your MacPorts installation for the fcix.net mirror, ensuring both port sources and binary archives are fetched from the fastest available source.
Configuration Files Overview
MacPorts uses three main configuration files located in /opt/local/etc/macports/:
sources.conf- Controls where MacPorts gets the ports tree (the list of available software)archive_sites.conf- Configures binary archive sources for faster installationsmacports.conf- Main configuration file with host preferences and other settings
For detailed information about these files, see the MacPorts Guide section on Configuration Files.
Step 1: Configure sources.conf
The sources.conf file tells MacPorts where to fetch the ports tree from. By default, MacPorts uses rsync from rsync.macports.org, but we can switch to the fcix.net HTTPS mirror for better performance.
Edit sources.conf
1sudo vi /opt/local/etc/macports/sources.conf
Replace with fcix.net mirror
Replace the default configuration with:
1https://mirror.fcix.net/macports/release/tarballs/ports.tar [default]
Note: If you’re using a local repository (like BlakePorts), list it first:
1file:///Users/yourusername/code/blakeports [default]
2https://mirror.fcix.net/macports/release/tarballs/ports.tar
The [default] tag indicates which source takes precedence when there are conflicts. For more information on configuring local repositories, see the MacPorts Guide section on Local Portfile Repositories.
Step 2: Configure archive_sites.conf
Binary archives are pre-compiled packages that allow MacPorts to skip the build phase, dramatically speeding up installations. The archive_sites.conf file tells MacPorts where to find these binary archives.
Create or edit archive_sites.conf
1sudo vi /opt/local/etc/macports/archive_sites.conf
Add fcix.net and MIT archive sites
Add the following configuration:
1# MacPorts configuration file for binary archive sources.
2
3# disable default by uncommenting the following line
4name macports_archives
5
6# MacPorts archive site fcix
7name fcix
8urls https://mirror.fcix.net/macports/packages/
9
10# MIT archive site
11name mit
12urls http://bos.us.packages.macports.org/
This configuration:
- Disables the default MacPorts archive site (which can be slow)
- Adds fcix.net as the primary binary archive source
- Adds MIT as a fallback archive source
For more information about binary archives, see the MacPorts Guide section on Port Binaries.
Step 3: Configure macports.conf
The macports.conf file contains system-wide settings. We’ll add host preferences to ensure MacPorts always prefers the fcix.net mirror for all downloads.
Edit macports.conf
1sudo vi /opt/local/etc/macports/macports.conf
Add host preferences
Add these lines at the end of the file:
1# Prefer fcix.net mirror for all downloads
2host_blacklist packages.macports.org distfiles.macports.org rsync.macports.org
3preferred_hosts mirror.fcix.net
This configuration:
host_blacklist- Prevents MacPorts from using the default slow hostspreferred_hosts- Tells MacPorts to prefer fcix.net for all downloads
These settings override MacPorts’ usual ping time checks, ensuring consistent use of the fcix.net mirror. For more details on configuration options, see the MacPorts Guide section on macports.conf.
Verification
After making these changes, verify your configuration:
1. Sync the port index
1sudo port sync
This updates MacPorts with the new sources. You should see downloads from mirror.fcix.net in the output.
2. Verify port information
1port info git
This should display information about the git port, confirming that MacPorts can access the ports tree from the new source.
3. Test an installation
Try installing a small port to verify binary archives are being used:
1sudo port install jq
If binary archives are available, the installation should be much faster as it skips compilation. You can verify this by checking the output - it should mention downloading archives rather than building from source.
Benefits Summary
Configuring MacPorts to use the fcix.net mirror provides several advantages:
- Faster Downloads - The fcix.net mirror provides significantly better download speeds than Fastly for users in the United States
- Binary Archives - Pre-compiled packages mean installations complete in seconds instead of minutes or hours
- Reduced Load - Using mirrors helps distribute load away from the primary MacPorts infrastructure
- Multiple Archive Sources - Additional archive sources provide options if one mirror is experiencing issues
- Consistent Performance - Host preferences ensure MacPorts always uses the fastest configured mirror
This configuration is particularly beneficial for users who frequently install or update MacPorts packages, as it significantly reduces the time spent waiting for downloads and builds.