# New user: startup question



## kyr0 (Dec 7, 2013)

Hey guys,

I am a new user just switching to FreeBSD on my laptop (with a graphical environment). Although I have a few questions. My background: Linux 10+ years. Mostly Arch, Gentoo and Debian for servers. My question: ports or packages? I think this question gets asked a lot but I would like to know what is the preferred way to install software, I am going to run KDE as a graphical environment.


----------



## Rulus (Dec 7, 2013)

Did you read this?

I usually use ports, especially for compile-time options.


----------



## kyr0 (Dec 7, 2013)

Rulus said:
			
		

> Did you read this?
> 
> I usually use ports, especially for compile-time options.



Yes I have, to clarify. I meant installing packages via the built binary or using the source to build it. My first question might have been confusing.


----------



## Rulus (Dec 7, 2013)

Well, that was what I understood, and that is, I think. 


> A FreeBSD package contains pre-compiled copies of all the commands for an application, as well as any configuration files and documentation.





> A FreeBSD port is a collection of files designed to automate the process of compiling an application from source code.


If you use ports, you are using the source to build it; if you use packages, you are using the built binary. If you use ports to generate a package, well, you are using ports  :e Isn't this what you ask?


----------



## kyr0 (Dec 7, 2013)

Rulus said:
			
		

> Well, that was what I understood, and that is, I think.
> 
> 
> > A FreeBSD package contains pre-compiled copies of all the commands for an application, as well as any configuration files and documentation.
> ...



Yeah, that makes sense. 

So is there any preferred way to install software within the community between compiling the packages from source, or using the pre-compiled version? Or is this something that comes down to personal preferences?


----------



## scottro (Dec 7, 2013)

The advantage of using packages is the speed and convenience.  The disadvantage is that it may be somewhat older than a port, and that you will be stuck with its default options.  
In many cases, this is fine.  However, you might find something like where you install program X with a package.  Then, you need program Y, but have to use a port because you need an option that you won't get with the package.  However, package X pulled in an older version of say, perl, and now, the port will want to recompile perl and several dependencies.  

That's a drastic example, and I don't think it's very frequent, but it's something to keep in mind.   My own opinion is that it's a matter of personal preference, but in many cases, people need to use the port to get a specific configuration.  (And after that, they can build a package from their port.)

Another thing people do is have a powerful machine to use to build ports, then use the packages built from those ports as packages on less powerful machines.


----------



## Rulus (Dec 7, 2013)

Generally, personal preferences, I think. But also there are factors to consider, for example, compiling KDE from source may take a while, so one factor would be the machine you are using; other example, if you want a feature that is not in the pre-compiled binary but it's in the port, you must compile it; that would be another factor.


----------



## pkubaj (Dec 7, 2013)

For quite many years the binary packages system was actually in quite a bad shape (until 10.0, or until 8.3 if you switch to PKGNG). However, since the introduction of PKGNG, it's getting increasingly better. Ports are still a few days newer and you can configure your compile options with them. Also note that when there are multiple possible packages for one port (as it is with X.Org packages) the only ones created are the default ones. With ports you can optimize your packages with CPUTYPE, it's not possible with binaries.


----------



## kyr0 (Dec 7, 2013)

Thanks for the replies. 

If you run into an issue where you are missing a compile option or need a newer version, is it easy to remove the pre-built package and replace that with the port? And how would something like that be done?


----------



## pkubaj (Dec 7, 2013)

You shouldn't mix packages and ports. That said, if you want to do it, it would be just `pkg delete x && portmaster category/x`. If you use pkg_* tools, just replace `pkg delete` with `pkg_delete`.


----------



## Rulus (Dec 7, 2013)

Also, once installed, there is no difference between ports and packages. But, as @pkubaj says, you shouldn't mix both; for example, if you install x using packages and then you install a port y that depends on x, as ports usually have newer versions than packages, y may need a newer version of x.


----------

