Using pkg in FreeBSD: Package Management Without Going Broke

 

If you're new to FreeBSD and wondering, “How do I install apps here, like apt install on Linux?”
The answer is simple: use pkg — FreeBSD’s friendly package delivery dude! 

What is pkg?

pkg is FreeBSD’s official package manager. It’s kind of like apt (Debian/Ubuntu) or dnf (Fedora), and it helps you:

  • Install apps
  • Update them
  • Uninstall apps
  • Check app info
  • And even—well, no dating yet, but it’s still helpful 

First-Time Setup (Usually Preinstalled)

In most cases, pkg is already installed. But if you run it and it’s not there, just type:

/usr/sbin/pkg

It will ask you:
“The package management tool is not yet installed. Do you want to fetch and install it now?”

Just type: y

Searching for Packages

Need a browser but forgot the name?

pkg search firefox

Or:

pkg search editor

It’ll list matching packages. Pick what you like!

Installing a Package

Once you’ve found a package you want:

pkg install package_name

Example:

pkg install neofetch

Voilà—now your terminal can flex your system info in style. 

Removing a Package

Had enough? Want to break up?

pkg delete package_name

Example:

pkg delete neofetch

Don’t worry—it’s a clean break. No hard feelings.

Updating Everything

Keep your system fresh and secure:

pkg update
pkg upgrade
  • pkg update: Fetch latest repo info
  • pkg upgrade: Upgrade all installed apps

Listing Installed Packages

pkg info

Want details on a specific one?

pkg info package_name

Cleaning Things Up

Get rid of packages no longer needed:

pkg autoremove

And clear the download cache:

pkg clean

Some Popular Packages

Category Package Names
Text editors nano, vim
Browsers firefox, chromium
Shells bash, zsh, fish
Tools neofetch, htop, curl
Servers nginx, mysql80-server

 

Tips

  • Don’t randomly pkg delete things—be careful!
  • Use pkg info -r to see what depends on a package
  • Make sure your internet is stable during updates (no heartbreaks)

Managing apps in FreeBSD is super easy with pkg. Just learn a few basic commands and you can:

 Install apps
 Remove them
 Update your system
 Search for new ones

All from the terminal—making you look 1337 even when you’re just installing cowsay

 

0 Comments:

Post a Comment