Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 693505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:45:38+00:00 2026-05-14T02:45:38+00:00

How could I programmatically install a font on the Mac platform (Snow Leopard)? What

  • 0

How could I programmatically install a font on the Mac platform (Snow Leopard)? What steps would I need to follow? I would like for the user to input a font file, then my software installs it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:45:39+00:00Added an answer on May 14, 2026 at 2:45 am

    Fonts belong in ~user/Library/Fonts/ for a single user or /Library/Fonts/ to be accessible to all users. You need to get permission in order to write to /Library/Fonts/, although there is an API for that which makes it relatively easy. (I have the code somewhere and can look it up if no one else knows offhand.)


    As requested, here are some API docs:

    http://developer.apple.com/mac/library/documentation/Security/Reference/authorization_ref/Reference/reference.html

    This is old code I have that did the update under Carbon (hence the pascal strings). It was based on sample code which is probably somewhere in the above URL. I haven’t looked into doing this under Cocoa, and this is a edited version of the code (still a bit messy), so YMMV.

    int main()
    {
        OSStatus myStatus = -1;
        char path[1024];
        char myToolPath[2048];
        getUpdateAppPath(myToolPath);
        getFilePath(path);
    
        if (path[0] != 0)
        {
            char temp[2048];
            FILE *f;
            printf("Attempting to open \'%s\'\n", path);
            f = fopen(path, "w+");
            if (f != 0) // we seem to have write permission
            {
                fclose(f);
                SInt16 res;
                sprintf(temp, "\'%s\' \'%s\'", myToolPath, path);
                system(temp);
                StandardAlert(kAlertNoteAlert, "\pUpdate Complete", "\pSuccessfully updated.", 0, &res);
                return 0;
            }
    
            AuthorizationFlags myFlags = kAuthorizationFlagDefaults;
            AuthorizationRef myAuthorizationRef;
            myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
                                           myFlags, &myAuthorizationRef);
            if (myStatus != errAuthorizationSuccess)
            {
                SInt16 res;
                StandardAlert(kAlertNoteAlert, "\pAuthorization Error", "\pCould not authorize application to update.", 0, &res);
                return myStatus;
            }
    
            AuthorizationItem myItems = {kAuthorizationRightExecute, 0, NULL, 0};
    
            AuthorizationRights myRights = {1, &myItems};
            myFlags = kAuthorizationFlagDefaults |
            kAuthorizationFlagInteractionAllowed |
            kAuthorizationFlagPreAuthorize |
            kAuthorizationFlagExtendRights;
    
            myStatus = AuthorizationCopyRights (myAuthorizationRef, &myRights, NULL, myFlags, NULL );
    
            if (myStatus != errAuthorizationSuccess)
                break;
    
            char *myArguments[] = { path, NULL };
            FILE *myCommunicationsPipe = NULL;
            char myReadBuffer[128];
    
    
            myFlags = kAuthorizationFlagDefaults;
            myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, myToolPath, myFlags, myArguments,
                                                          &myCommunicationsPipe);
    
            if (myStatus == errAuthorizationSuccess)
                for(;;)
                {
                    int bytesRead = read (fileno (myCommunicationsPipe),
                                          myReadBuffer, sizeof (myReadBuffer));
                    if (bytesRead < 1) break;
                    write (fileno (stdout), myReadBuffer, bytesRead);
                }
    
            AuthorizationFree (myAuthorizationRef, kAuthorizationFlagDefaults); // 17
        }
        if (myStatus)
        {
            printf("Status: %ld\n", myStatus);
            SInt16 res;
            StandardAlert(kAlertNoteAlert, "\pUpdater Error", "\pMay not have updated properly.", 0, &res);
        }
        else {
            SInt16 res;
            StandardAlert(kAlertNoteAlert, "\pUpdate Complete", "\pSuccessfully updated.", 0, &res);
        }
        return myStatus;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a signed driver and I need to install it programmatically for a
Could I disconnect to wifi programmatically in Cocoa?
Could somebody please do a rundown of how to programmatically encrypt a config-file in
Could you provide an example of accessing the Eclipse Abstract Syntax Tree programmatically for
Could some one guide me to create a APS logon token in .Net programmatically?
Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could
Could someone recommend any good resources for creating Graphics User Interfaces, preferably in C/C++?
How could I programmatically trigger a left-click event on the mouse? Thanks. edit: the
Is it possible to programmatically change the Default.png launch image? For example, could I
In C#, how could I generate the following image programmatically? http://deathmatchgame.files.wordpress.com/2010/07/color_picker.png I am well-aware

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.