2023-07-05 18:29:11 +00:00
An alternative package installer to the more popular Homebrew though much older. The project started in 2002 as an initiative from Apple employees to install UNIX packages. Similar to Fink, Homebrew and BSD ports collections.
---
#### Installing
---
To install a package:
```
sudo port install packagename
```
Update outdated ports:
```
sudo port selfupdate
sudo port upgrade outdated
```
2023-12-19 09:23:50 +00:00
Reclaim disk space:
```
sudo port reclaim
```
2023-07-05 18:29:11 +00:00
By default, MacPorts does not collect any statistics. However, users can optionally submit information by running:
```
sudo port install mpstats
```
Searching available package:
```
port search --name --glob 'git*'
```
List outdated packages:
```
port outdated
```
```
sudo portupgrade outdates
##or for specific things
sudo port upgrade gnupg2
```
List installed packages
```
port installed
```
Looks at contents of port:
```
port contents portname
```
`Contents` is helpful for finding the location of a port's executable after installing it
```
port -q contents _`portname`_ | grep -E '/s?bin/
```
2023-12-19 09:23:50 +00:00
---
2023-07-05 18:29:11 +00:00
#### Uninstalling
---
Uninstalls a package
```
sudo port uninstall portname
```
Typically packages will also have dependent packages that were installed as well.
```
#to tag dependent packages
sudo port uninstall --follow-dependents portname
```
List which ports depend on a given installed port.
```
port dependents openssl
```
---
## References:
---
2023-12-19 09:23:50 +00:00
For further info, refer to either the MacPorts [Guide ](https://guide.macports.org/ ) or official [Wiki ](https://trac.macports.org/wiki )
- Here are [more common tasks ](https://guide.macports.org/chunked/using.common-tasks.html ) that are often made in MacPorts