Jump to content

Set default app. Adobe Reader


Mike Henderson

Recommended Posts

  • Moderators

I used ChatGPT and popped out this code as well. It'll walk through all the users with an ID above 500 which should be all normal users, and use the duti command to set Adobe Reader for every user. duti won't be on the machine unless you put it there but you could use https://formulae.brew.sh/formula/duti to get it on your machine and then package up the /usr/local/bin/duti terminal command to use it in the script. I tested this and it did switch the 3 accounts on my laptop to use Reader. 

#!/usr/bin/env zsh

# Get a list of all users on the system
users=( $(dscl . -list /Users UniqueID | awk '$2 > 500 {print $1}') )

# Loop through each user
for user in "${users[@]}"; do
    # Run the duti command as the current user
    su "$user" -c "/usr/local/bin/duti -v -s com.adobe.Reader pdf all"
done

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...