# /opt directory replacement



## AlexF (Mar 24, 2010)

What FreeBSD directory can I use instead of /opt that exists in the Linux?


----------



## gilinko (Mar 24, 2010)

Why not create it you need it?


----------



## AlexF (Mar 24, 2010)

I can do this, but I prefer to follow OS guidelines, and place my program to the place where other programs are installed.


----------



## SirDice (Mar 24, 2010)

Everything that isn't part of the base OS (ports) is installed with the /usr/local/ prefix.


----------



## AlexF (Mar 24, 2010)

Thanks.


----------



## graudeejs (Mar 24, 2010)

if you want to use use custom builds, then I suggest to install in /usr/local/opt
and add /usr/local/opt/bin to your PATH environment variable
This way you won't mess ports with custom installed software, and it's easy to fix if anything goes wrong

As SirDice said I'd set PREFIX=/usr/local/opt for custom software, that aren't part of ports


----------



## phoenix (Mar 25, 2010)

hier(7)


----------



## graudeejs (Mar 25, 2010)

another option could be to install in somewhere in home directory if you don't want others to have access to these apps


----------



## gcooper@ (Mar 26, 2010)

phoenix said:
			
		

> hier(7)



As is noted at the bottom of the document...


```
NOTES
     This manual page documents the default FreeBSD file system layout, but
     the actual hierarchy on a given system is defined at the system adminis-
     trator's discretion.  A well-maintained installation will include a cus-
     tomized version of this document.
```

So it's up to you where to put things, but as a basic rule of thumb, everything 3rd party goes into /usr/local (including /opt on Linux, which is just another whacky idiom for /usr/local)


----------



## jalla (Mar 26, 2010)

killasmurf86 said:
			
		

> if you want to use use custom builds, then I suggest to install in /usr/local/opt
> and add /usr/local/opt/bin to your PATH environment variable
> This way you won't mess ports with custom installed software, and it's easy to fix if anything goes wrong
> 
> As SirDice said I'd set PREFIX=/usr/local/opt for custom software, that aren't part of ports



Bad advice. What do you propose to do with libs, configfiles, rcscripts, manpages, docs...?

(BTW I think you misquoted SirDice)


----------



## troberts (May 19, 2013)

jalla said:
			
		

> Bad advice. What do you propose to do with libs, configfiles, rcscripts, manpages, docs...?


What about self-contained binaries? Isn't that how PC-BSD packages their applications in the PBI? While self-contained binaries would use more space they could, without causing problems with a working system, make it easier to:
build, test, and use a newer version of an application that is in ports (i.e. graphics/gimp v2.8.x instead of v2.6.x)
create your own or build a third party application, even if it uses libraries that are in ports. 
modify an application that is in ports with changes you intend to send back to the maintainer so it can get incorporated into a future release. For example; modify audio/moc or audio/cmus to use audio/faad2 for playing AAC/M4A files instead of using multimedia/ffmpeg.
"freeze" an application that is in ports but is in danger of disappearing (i.e. it is no longer being maintained, it uses old libraries that are being removed from ports, etc.)


----------



## JibJabM (Jan 31, 2020)

jalla said:


> Bad advice. What do you propose to do with libs, configfiles, rcscripts, manpages, docs...?


Then what exactly do you propose for us? Not very helpful on the forum to shoot down advice without providing a valid alternative. There should be an agreed upon directory for random software.


----------



## ralphbsz (Feb 1, 2020)

JibJabM said:


> Then what exactly do you propose for us?


See hier(7), which clearly says for /usr/local: "local executables, libraries, etc.", and then goes into detail.


----------

