Skip to content

Instantly share code, notes, and snippets.

@shayelkin
Created August 23, 2024 19:30
Show Gist options
  • Save shayelkin/9a5a0d5fb83cd0336ac190a9e7681757 to your computer and use it in GitHub Desktop.
Save shayelkin/9a5a0d5fb83cd0336ac190a9e7681757 to your computer and use it in GitHub Desktop.
Update all installed MacPorts packages
#!/bin/zsh
sudo port selfupdate
outdated_ports=$(port echo outdated)
if [[ -z $outdated_ports ]]; then
exit 0
fi
echo "$outdated_ports \n---> Upgrade outdated ports? "
read -q
echo
if [[ $REPLY = "y" ]]; then
sudo port upgrade outdated
fi
inactive_ports=$(port echo inactive)
if [[ -z $inactive_ports ]]; then
exit 0
fi
echo "$inactive_ports \n---> Remove inactive ports? "
read -q
echo
if [[ $REPLY = "y" ]]; then
sudo port uninstall inactive
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment