Automated font instalation

drewsanderson
New Contributor

Solved: Use configuration profiles.

I need to make sure all users have access to the font used in our branding for printing documents like invoices from FileMaker. I need to distribute this without user interaction. So far I have written this script. It downloads the font to ~/Library/Fonts/. It works, but the font is not available. I can't ask these users to work with Font Book.

#!/bin/bash
cd ~/Library/Fonts

file="./sampleFont.otf"

if [ ! -f "$file" ]
then
    curl -O https://someHostName/$file
fi
20 REPLIES 20

andrew_nicholas
Valued Contributor

How have you confirmed that it works? You might be better off not changing to the users Fonts directory and just placing the curl'd file in a /tmp directory and moving it to the systems Font library (/Library/Fonts) so that all users on the machine have access to it .

daniel_ross
Contributor III

Also you can use a profile to do this as well. We push down all the fonts via that with really good success and it’s consistent.

drewsanderson
New Contributor

@andrew.nicholas That is a great point about being available to all users.

@daniel_ross Can you provide more details or some reading ghat you think could better direct me on this?

jtrant
Valued Contributor

We also push corporate fonts using a Configuration Profile - it's very easy. Create the profile, click the "Font" payload and upload the fonts you would like to distribute. Using a configuration profile also means you can update the fonts later on, should they chance or you wish to add more to the list.

daniel_ross
Contributor III

@jtrant beat me to the reply @drewsanderson but yeah we have 21 corp fonts loaded into the profile and they all then get pushed out to various machines and if we add more its as simple as just adding the new one to the profile and pushing out the change.

I attached the images below for you to see how we have it set up.

fbb95de772b0462887b9060e5a95a031
d01e740dddc549b3b5fdee726f7d0703

drewsanderson
New Contributor

So simple yet Jamf sport could not answer the question. I really appreciate the help! I was successful just using the configuration profile. No need for scripts, library folder, etc.

daniel_ross
Contributor III

@drewsanderson that's odd to hear as JAMF support is the group that confirmed this would work for what we were trying to accomplish almost a year ago. I still feel that JAMF support could be better with internal knowledge transfer or a KBASE for these sorts of things but thankfully JAMF Nation exists!

luchotamblay
New Contributor

Thank you guys for this discussion. I was able to create a Configuration Profile and push 18 fonts quickly. I appreciate all you guys! Thank you!

rhooper
Contributor III

@daniel_ross this is awesome. Thanks so much

gbunner
New Contributor III

Hello all! I currently use this method (config profile) to push out 1 or 2 (or small hand full) of fonts a user might need, but I'm wondering if there is a better way? I'm faced with the need to push and activate a folder full of 60 fonts to a user that's needed for some current projects he is working on. I could obviously copy them to his computer and manually activate them through FontBook but I would like to somewhat automate the process since I'm sure I will need to do this again at some point. any ideas before I go to adding all of these to a config profile?

Thanka!

erichughes
Contributor II

So how is this getting scoped? I have the Profile with corporate fonts socked to a smart group where the criteria is, does not have said font. Works great sees the computers that don't have it, then pushes the font, sweet. Computer falls out of smart group. Here is the problem. When it falls out of the group the profile gets removed, starting the whole thing over. I know it's a problem with my scope or group, just not sure the best way to scope it without saying, All managed computers, even though that wouldn't be the worst idea.

pittman
New Contributor II

JAMF support has frowned on using Configuration profiles to push fonts. not that i have an immediate solution but - just ti aid people googling for best practice / keep looking

scottb
Honored Contributor

@jpittman-fsit - if that is the case, I think that based on the results above we'd need more info to make that decision - as in, why not?
Probably like all admins, Jamf employees have a variety of methods to do something, and I'd like to hear the "why" before nixing what appears to be a functioning solution...

pittman
New Contributor II

@scottb - sorry for the late response, the reasoning was to minimize the amount of configuration profiles in efforts to aid in JAMF cloud performance and accuracy. I found that packaging them up in a .pkg and deploying via a profile works amazingly - also able to add to self-service that way.

ajfunk
Contributor

@daniel_ross any advice on pushing OTF fonts to users? Config profiles don't appear to support the OTF file extension.

pittman
New Contributor II

@daniel_ross package them up in a .pkg and upload them to JAMF - push them with profiles or self-service. I've been implementing this method for some time now.

jsuarez
New Contributor

nm

ryan_ball
Valued Contributor

@drewsanderson if you are running that as a policy, the user probably does not have access to read the font. You would have to modify the permissions of the font file afterward:

#!/bin/bash

loggedInUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }')
directory="/Users/$loggedInUser/Library/Fonts"
file="sampleFont.otf"

# If a user is logged in, and the file does not exist, download it and make the currently logged in user owner
if [[ -n "$loggedInUser" ]]; then
    if [[ ! -f "$directory/$file" ]]; then
        curl -s "https://someHostName/$file" -o "$directory/$file"
        chown $loggedInUser "$directory/$file"
    fi
fi

exit 0

Alternatively, as others stated. You might be better off just putting the font in /Library/Fonts (available to any user) rather than the user's Font folder, and then you can just set the permissions to 644:

#!/bin/bash

directory="/Library/Fonts"
file="sampleFont.otf"

if [[ ! -f "$directory/$file" ]]; then
    curl -s "https://someHostName/$file" -o "$directory/$file"
    chmod 644 "$directory/$file"
fi

exit 0

walt
Contributor III

(i realize this is old but have been looking for options to deploy readily available fonts).

considering these options as well. we push fonts to iOS via profile but have more than 50 fonts (global languages, etc) and push them as a package into the /Library/Font folder.

@jpittman-fsit when you say push out the package via a profile, what does that mean? did you mean policy as I am not familiar with "Push a pkg with a profile".

donmontalvo
Esteemed Contributor III

Out of curiosity, seems the Managed Fonts are placed here, and the hash(?) is only on the file. Font Book shows the proper info.

DonM_ 2022-09-07 at 9.22.35 AM.pngDonM_ 2022-09-07 at 9.16.49 AM.png

--
https://donmontalvo.com