I am trying to download the source code for wget in Mac.
I managed to get the source code of wget in Ubuntu by
apt-get source wget
However, I have not managed to download source codes in Mac’s terminal. I did not find the same utility in MacPorts.
MacPorts is a source-based package manager. That means that each time you install a package via MacPorts, it downloads the source, potentially patches it, configures it, builds it, installs it to a temporary location (so it can track which files the port needs), makes an archive of it, then installs that archive into the MacPorts root, which is usually
/opt/local.If you want to look at or edit the source before building it, you can execute a subset of the steps necessary to download and install it.
port extract <name>will download and extract the source for the port, without actually building or installing it. You can then find the extracted source withport dir <portname>:See the MacPorts guide for more information on developing ports, and also
man port.