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

  • SEARCH
  • Home
  • 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 7625495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:11:58+00:00 2026-05-31T05:11:58+00:00

I have a MacRuby app that is meant to be customized and distributed by

  • 0

I have a MacRuby app that is meant to be customized and distributed by other people. The app really only has a few things that can be customized, but I would like to figure out a way to package the application so that a person could run a script, specify a few configuration options, and have it set up the application configuration so that it is ready to distribute to others.

For example, I have a string that points to a URL. I want someone to be able to change this URL without needing to open the project in XCode, and without having to re-build (or re-compile) so that someone on Windows or Linux could make this change.

Is this sort of thing possible? I’m new to MacRuby and Objective-C, so there may be an obvious solution to this that I am not aware of.

My Solution:

I used a plist file with the name AppConfig.plist that looked like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>homepage</key>
    <string>http://google.com</string>
</dict>
</plist>

And my App Delegate could access it like this:

config_path = NSBundle.mainBundle.pathForResource('AppConfig', ofType: 'plist')
@config = load_plist File.read(config_path)
# then access the homepage key like this: @config['homepage']
  • 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-31T05:11:59+00:00Added an answer on May 31, 2026 at 5:11 am

    The easiest way, as jkh said, is to use a plist. For example, you can store the needed customizations in Stuff.plist in the root of your project and access it using the following:

    stuff = load_plist File.read(NSBundle.mainBundle.pathForResource('Stuff', ofType: 'plist'))
    

    or if, for instance, Stuff.plist is in your Resources folder (where it probably should be)

    stuff = load_plist File.read(NSBundle.mainBundle.pathForResource('Stuff', ofType:'plist', inDirectory:'Resources'))
    

    stuff is now a Hash (or NSMutableDictionary) of your stuff. For example if Stuff.plist looked like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>my_stuff</key>
      <dict>
        <key>favorite_color</key>
        <string>green</string>
        <key>first_car</key>
        <string>Reliant K</string>
            </dict>
            <key>his_stuff</key>
            <dict>
        <key>favorite_color</key>
        <string>blue</string>
        <key>first_car</key>
        <string>240D</string>
            </dict>
      </dict>
      </plist>
    

    You should be able to access the values in the following way:

        my_favorite_color = stuff[:my_stuff][:favorite_color]
    

    I didn’t actually test this in an application bundle, but I did test it using macirb. To play around with it yourself, you can load a plist file from macirb using the following:

    stuff = load_plist File.read('/path/to/Stuff.plist')
    

    MacRuby implements a load_plist on Kernel, but no write_plist or anything like that, however MacRuby does implement a to_plist on Object, so anything can be written to disk as a plist!

    File.open('/path/to/new_plist.plist','w'){|f| f.write(['a','b','c'].to_plist)}
    

    which gives you:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
        <string>a</string>
        <string>b</string>
        <string>c</string>
    </array>
    </plist>
    

    Now the user can define the customizations directly via plist and the already built app will read the values at runtime. Be careful with this, since you don’t want to accidentally eval any rm *s.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small MacRuby app that displays some text inside a NSTextView .
I am writing a simple MacRuby app. I have an NSView that draws an
Module in macruby has many methods that it doesn't usually have. One of these
I have a MacRuby app, and after the app launches, I would like to
I have just written my first hello world MacRuby app using XCode. I would
I want to use MacRuby to tell Mail.app to check for new email. But
I have a NSTextField within a Window and I created a very simple MacRuby
have anyone can tell me what syntax error on this actionscript (actionscript3.0)? var rotY:
Have a bunch of WCF REST services hosted on Azure that access a SQL
have been trying couple of hours now to make my iphone app universal. The

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.