📜 ⬆️ ⬇️

Install MacPorts on Mac OS X

MacPorts is a system of packages, with the help of which it is quite simple to download, compile, install free software, various libraries, and also update MacOS X and Darwin through the terminal.

To perform all the above actions, if you have MacPorts, just enter in the terminal window

port install packagename

where '' packagename '' is the name of the package to be installed.
')
But in order for everything to work just as beautifully for you, you need to install this very MacPorts.

Despite the detailed instructions , I still faced some difficulties in installing this software, which prompted me to summarize the articles I read.

If you are going to install MacPorts from source, then this article is not for you. Read Installing MacPorts .



Xcode



It is not surprising, but first you will need to download the installation package not with the name MacPorts, but XCode, without which MacPorts simply won't be installed.

If you have a new Mac OS X, then it will be enough:
* download the Xcode installation package corresponding to your version of the operating system (to download, you need to register for free in the Apple Developer Connection )
* run the installation of Xcode Tools and install this application using all the default settings


X11



In this and the following paragraphs I advise you to be especially attentive, since It was with the wrong setting of the “X” that everything was gone.

* run from '/Applications/Utilities/X11.app' '(' / Programs / Utilities / X11.app '')
* in the menu “Programs” choose item “Configure”
* double click on the '' Terminal '' item, where we change the '' xterm '' to '' xterm -ls ''


Macports



* download the latest version of MacPorts-1.xxdmg
* double click on macports-1.xxpkg
* install with default settings


Shell



We start the terminal. We enter in it

ls -a

and look for a file in the resulting result called '' .profile ''

If there is none, then try to create it:

nano .profile

We have a file editing window in the terminal. Write a string to it

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Attention: if you have Mac OS X 10.4 Tiger or an earlier version, then you should also add the following line to the file (in no case do not add it if you have Mac OS X 10.5 Leopard or higher):

export DISPLAY=:0.0

Press ctrl + O to save the file.

If you already have such a file, then we do the same thing, adding the lines described above to the file.

In order for all changes to take effect, you must restart the terminal.

If everything went well, then when you enter the command in the terminal

port

you should have something like this:

MacPorts 1.600
Entering interactive mode... ("help" for help, "quit" to quit)
[Users/username] >


First application



Let's try to update MacPorts. To do this, run the terminal and enter in it

sudo port selfupdate

or, to display additional information in the process of execution, add -d

sudo port -d selfupdate

It should be noted that this command is not very fast. So be patient and do not press the extra buttons.

Approximate result:

DEBUG: Rebuilding the MacPorts base system if needed.
DEBUG: Synchronizing ports tree(s)
Synchronizing local ports tree from rsync://rsync.macports.org/
release/ports/
DEBUG: /usr/bin/rsync -rtzv --delete-after
rsync://rsync.macports.org/release/ports/
/opt/local/var/macports/sources/rsync.macports.org/release/ports
receiving file list ... done
...
Downloaded MacPorts base version 1.600

The MacPorts installation is not outdated and so was not updated
DEBUG: Setting ownership to root
selfupdate done!


I hope everything went smoothly for you and, most importantly, everything works.

Resources


1. MacPorts.org
2. MacPorts Guide
3. Installing MacPorts
4. MacPorts Portfiles

Source: https://habr.com/ru/post/22636/


All Articles