Friday, January 05, 2018

A Very Simple "launchd" Example for MacOS

Arg. I've been struggling for days! to get a simple launchd example to work. None of the examples I found in the googlesphere got me there. Here's my working example.

Although I generally avoid being root for more than a single sudo command, I'm gonna sudo into root for this. Open Terminal (Cmd-Spacebar to open the Search window, then search for and Enter on "terminal".)
$ sudo -i
Then move into the /Users/Shared directory, and create a "Scripts" directory, and then move into that directory:
# cd /Users/Shared
# mkdir Scripts
# cd Scripts
Create a very simple Bash script here using nano:
# nano
(You could also use any other plain-text editor, such as TextEdit (yuk!) or TextWrangler (yum!, but it's a third-party download). Whatever text editor you use, put the following into your "":
Exit out of your text editor, saving the file. (If you use TextEdit, make sure it's a plain text file, etc.)

Make sure the file is readable and executable by root:
# chmod +x
# chown root:wheel
And test it to make sure it works. Currently, there should be no file named "ITWORKS" in the /Users/Shared/Scripts directory. After you run it, there should be such a file.
# ./
If the script worked properly, you'll now have an empty file named "ITWORKS" in the /Users/Shared/Scripts directory. (You'll want to remove this file manually (# rm ITWORKS) afterwards for additional testing.)

Okay, so we have a working script. Now we want to use launchd to run this script once at boot-time.

Create a new file named "local.itworks.plist" (# nano local.itworks.plist), and put the following text into it:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">


Now this file needs to be placed in the appropriate directory for launchd items. If it was an Apple-provided .plist file, it'd go in /System/Library/LaunchDaemons (for root-run items) or /System/Library/LaunchAgents (for user-run items). (Daemons and Agents are the same thing; just named differently for who runs them, root or users.) But we're not Apple. If we wanted the item to be a launchd item for just "me", it'd go into my home folder's Library directory, ~/Library/LaunchAgents. But we want this to run as root, on startup, so we'll put it in /Library/LaunchDaemons.
# mv local.itworks.plist /Library/LaunchDaemons
And we need to make sure it has the correct permissions:
# chown root:wheel /Library/LaunchDaemons/local.itworks.plist
# chmod 755 /Library/LaunchDaemons/local.itworks.plist
(You could be more restrictive with the perms, such as chmod 700, but this should be okay for our purposes.)

Now we're ready to test it. Make sure that you have removed "ITWORKS" from the /Users/Shared/Scripts directory, or we won't know if the launchd item works or not, and then tell launchd to load this new service you have created:
# launchctl load /Library/LaunchDaemons/local.itworks.plist
If you see no errors, that's good. If you now see an "ITWORKS" file in the /Users/Shared/Scripts directory, that's great! Your new launchd service works!

You can get a list of running launchd items with:
# launchctl list
or you can narrow that list down with:
# launchctl list | grep local.itworks
If you need to edit the .plist file, you'll need to first stop/unload the service:
# launchctl unload /Library/LaunchDaemons/local.itworks.plist
Hopefully this will get you started with a successful launchd experiment, that will cause your script to run at each boot of the Mac.

Thursday, December 28, 2017

Dying Assemblies

Our assemblies are dying because they're not fulfilling their God-given purpose.

Our church leaders "learned" in the 1950s that the purpose for assemblies is to "worship correctly", which puts the focus on singing right and preaching the right message and doing the Lord's Supper right and controlling who can say what when and all these "regulations", which have the appearance of wise worship.

There's nothing wrong with these things, but that's not what our leaders should focus on. Our leaders were given to us for a different purpose:
WEB Eph 4:[11 ]He gave some to be apostles; and some, prophets; and some, evangelists; and some, shepherds and teachers; [12 ]for the perfecting of the saints, to the work of serving, to the building up of the body of Christ...
If you're a church leader, and you're not helping your sheep mature to the point of serving and building, you're not doing your job.

Your purpose is not to conduct a "God-pleasing worship service". Your purpose is to conduct a personal-growth seminar.

Paul writes this same message elsewhere:
WEB 1 Cor 14:[26 ]What is it then, brothers? When you come together, each one of you has a psalm, has a teaching, has a revelation, has another language, has an interpretation. Let all things be done to build each other up.

It's about training each member of the flock to develop and use his own God-given gifts, whatever those gifts are, to be used in the service of God's kingdom.

Can you imagine the difference we'd make in the world if we were producing armies of men and women trained to use their skill-sets in the work of the kingdom? Medical researchers giving sight to the blind. Lawyers defending the rights of the oppressed. Film-makers drawing in block-buster crowds to be influenced to no longer steal but to work productive lives. Business managers who keep the books honestly. Employers who "do right" by their employees. Engineers who develop life-enhancing products cheap enough for third-world countries. Farmers who feed the starving. Spiritual advisors who pray in Jesus' name with their clients. Public speakers who inspire listeners to make the right choices in life. Power-point developers who make God's message vibrant and alive. Software programmers who hide God-honoring easter eggs in their work. Singers who put the Norman Fishing-Tackle Choir to shame. People who make a difference in the world, because their God-given talents were developed by godly leaders who have learned to recognize and nurture those talents in each individual.

From Jesus' first public sermon:
KJV Luke 4:[18 ] The Spirit of the Lord is upon me, because he hath anointed me to preach the gospel to the poor; he hath sent me to heal the brokenhearted, to preach deliverance to the captives, and recovering of sight to the blind, to set at liberty them that are bruised....
The assemblies are not about worship (although that does take place in the assembly). The assembly is about identifying and nurturing each one of us to do good works:
WEB Heb 10:[24 ]Let us consider how to provoke one another to love and good works, [25 ]not forsaking our own assembling together, as the custom of some is, but exhorting one another; and so much the more, as you see the Day approaching.
That may mean breaking away from our traditions of two songs, a prayer, a song, the Lord's Supper, a song, a sermon, an Invitation, contribution, and a closing hymn and prayer. It may mean breaking into small groups, learning how to place our hands on one another and praying as a group. It may mean setting aside time to ask each member, "What's happening in your life?", so we can get to know each other and each other's needs. It may mean spending less on the outdated bus program and sending a young Christian to medical school instead, who then cures cancer or provides doctoring to the congregation's been-there-a-year full-time members at an 80% discount for ten years after graduation. It may mean game-show style learning opportunities instead of 30-minute one-way sermons that are completely wasted on the post-MTV generation. It may mean adapting the assembly in whatever way is needed to develop 21st century Christians into 21st century kingdom powerhouses.

It starts with the leaders. Are you developing your flock according to their bent, or are you simply scratching your own itch to talk into a microphone?
ISV Prov 22:6 Train a child in the way appropriate for him, and when he becomes older, he will not turn from it.

Thursday, December 14, 2017

Even Whores Matter

- Tamar, the presumed prostitute, was declared more righteous than the ancestor of Jesus' tribe - Gen 38.

- Rahab the prostitute was a heroine of the faith - Heb 11:31.

- One of the judges of Israel, Jepthah, was the son of a prostitute - Judges 11:1.

- Hosea married a prostitute - Hos 1:2.

- The woman who wiped Jesus' feet with her hair was a "sinner" - Luke 7:37.

Not sure what meaning I'd take from this, but I find it interesting.

Sunday, December 03, 2017

Jesus Was Probably Not Born On Christmas. So?

The most important birth in the history of the world, and we argue that it is sin to assign a day to remember it, just because we're not told to do so.
WEB 2 Cor 10:4 for the weapons of our warfare are not of the flesh, but mighty before God to the throwing down of strongholds, 5 throwing down imaginations and every high thing that is exalted against the knowledge of God, and bringing every thought into captivity to the obedience of Christ;
It is OUR JOB to destroy things exalted against God, like paganism, and CAPTURE everything, like pagan practices, for Christ's glory.

If Christmas trees belonged to the Druids, we need to CAPTURE them for Christ.

If Halloween belonged to demons, we need to CAPTURE the day for Christ.

If Springtime Fertility Festivals belonged to Ashtarte ("Easter"), we need to CAPTURE the day for Christ.[1]

We are to bring every thought, every day, every moment, into captivity to the ownership of Christ.

Caesar is not Lord, despite the claims of the first-century pagans. Jesus is Lord.

God did not "authorize" the set-apart ("holy") days of Purim, or the set-apart days of Hannakuh ("Festival of Lights"), or the set-apart days of Christmas. God's people "captured" these days to honor the Lord. And at least in the first two cases, God approved, the first by including in the Bible an entire book to explain the holiday's origins, and in the second case by having Jesus right in the middle of the festivities.

WEB Matt 23:24 You blind guides, who strain out a gnat, and swallow a camel!
Focusing on the tithing of pennies, and completely missing the far more important tasks of justice and mercy and fidelity. How can you be faithful to Jesus if you're going around yelling, "Don't freely honor him whenever the opportunity arises! Stick to the legalistic rules that we assume apply because we know Jesus only cares about exact obedience and not about the heart!"
WEBm Matt 15:7 You hypocrites! Well did Isaiah prophesy of you, saying,
‘These people draw near to me with their mouth,
and honor me with their lips;
but their heart is far from me.
And in vain do they worship me,
teaching as doctrine rules [like "No Christmas!"] made by men.’”


1. These holidays don't actually have pagan origins, but most people believe they do, and trying to explain otherwise in the blog post would just get in the way of my message.

Monday, November 13, 2017

Being Good Out of Self-Seeking?

What motivates a person to be a Christian?

Isn't it ultimately for the sake of the person himself? Perhaps to avoid hell, or to gain paradise, or because he's driven to serve a principle, such as the principle of Righteousness, or the principle of Truth?

Whatever the motivation, does it not boil down to a selfish, "#1 gets what he wants in the end" reason?

And that has bothered me. I should seek to be righteous for selfless reasons, not for selfish reasons. And yet, no matter how I turn it and look at it, the reasons boil down to "My Choice", which means I'm getting my way, which means ultimately, selfishness.

No matter how selfless my choices in this life, ultimately they're driven by a selfish hope of a valuable pay-off in the future.

And I don't want to be selfish.

But then I read a passage I've heard/read many times before, and realized, Jesus sacrificed himself for his own selfish reason. Here it is:
WEB Heb 10:looking to Jesus, the author and perfecter of faith, who for the joy that was set before him endured the cross, despising its shame, and has sat down at the right hand of the throne of God.
 Jesus endured the cross because he saw a valuable pay-off in the future - "Joy".

If Jesus can be selfish in his motivation to do the right thing, I reckon I can be, too.

Tuesday, September 26, 2017

Pharos Printing from Linux

Pharos Printing from Linux
This document assumes you’re installing on a Debian 9.x computer, and that you’re printing to a Pharos release station, not to an actual Pharos printer queue. If you need the latter, you can probably add the functionality by recoding /usr/local/bin/pharospopup to ask for a password, and recoding /usr/lib/cups/backends/pharos to process that password, but I’ve not looked into that at all. Maybe next year, in the Year of the Linux Desktop ;-)

1 - Install CUPS

aptitude install cups

2 - Install Python

  1. Install Python
    1. aptitude install python
  2. Test for wx
    1. Start python (“python” at the command prompt)
    2. At the python prompt (>>>), type “import wx”. If you get no errors, great! If you get a message that no module named “wx” is found, you’ll have to install that piece (see below)
    3. Exit python with “quit()”.
  3. To install the wx modules,
    1. aptitude install python-wxgtk3.0
    2. Repeat the text for wx as above.

3 - Install pharos-linux

This is an open-source pharos client for Linux, written in python (which is why you installed python above).

  1. On the green button to the right, that says “Clone or download”, choose “Download zip”.
  2. In a Terminal window, navigate to where you downloaded the zip file, and unzip it:
    1. cd ~/Downloads  (for example)
    2. unzip
  3. Navigate into the directory created by the unzipping above:
    1. cd pharos-linux-master
  4. Here you have to create a “printers.conf” file. This will be different than the CUPS “printers.conf”, so don’t get them confused. But you may need some info (like the printer driver name, etc) from the CUPS version of the file, so you may want to create a dummy printer temporarily in order to collect that info:
    1. Web-browse to “localhost:631”
    2. Use this normal CUPS interface to create a temporary lpd:// version of the printer you’re wanting to install. Make sure to make it as accurate as you can, including the IP address and model and driver.
  5. Now that you’ve created a temporary dummy printer in CUPS, you can look in the “/etc/cups/printers.conf” file for some of the info you’ll need in the pharos “printers.conf” file. Create/edit “printers.conf”. Mine, for an HP Laserjet p4015dn printer, looks like this:

# ACU Brown Library Kiosk Printer Configuration File

Model=LaserJet p4015dn
Location=Brown Library Circ Desk
Description=Circulation Desk Printer

The “README” and “CONFIGURATION” files may provide you some help.

On one of my machines, I had to aptitude install printer-driver-hpcups to get the correct driver installed for this printer.

  1. Now that you’ve created the pharos version of the “printers.conf”, you can run the pharos setup program:
    1. ./
  2. If all goes well, you should see a message that remote printing has been successfully installed.
    1. This created a new “backend” processor for CUPS, named “pharos”. This is what allows you to select “pharos” as the protocol when you add (or modify, as in the next step) a new printer. If you're curious to see the file, you can find this new backend in the “/usr/lib/cups/backend” (“/usr/libexec/cups/backend” on Macintosh, just FYI) directory.
    2. It installed some executables and config files in “/usr/local”, such as “/usr/local/bin/pharospopup” (which is the python script that creates the popup window when you print).
    3. It created a symlink to “/usr/local/bin/pharospopup” in the KDE or Gnome startup locations of any users it found on the system, so that the popup client "daemon" will be running in the background when you start KDE/Gnome, which watches for print jobs sent to the Pharos printer and then pops up the credentials window. In my case, running XFCE4 instead of KDE or Gnome, I had to manually create an autostart item (using the XFCE4 System Settings GUI, but I could have done it by hand in the “~/.config/xfce4/autostart” directory) that runs the “/usr/local/bin/pharospopup” executable” when XFCE4 starts up. When this executable is running, you should be able to see it with a “ps ax | grep pharos”. If it’s not running, something’s wrong (did you log out / back in?).
  3. Now you need to go back to your CUPS configuration page (web-browse to localhost:631), and “Modify” your temporary printer, changing only the protocol from the lpd:// you used earlier to the newly-available “Pharos” protocol (not named that; can’t recall or access at the moment).
  4. If all has gone well, when you try to print, you’ll get a popup asking for printing credentials, and all should be working.
  5. If your printer dialog has more printers than just the ones you want, you can turn that off. Apparently in earlier versions, the “browse” options in “/etc/cups/cups.conf”, or the “/etc/cups/cupsd-browsed” were controlling factors, but now Avahi seems to override those settings. (You can even turn off CUPS altogether, and your wanted printer goes away, but the autodiscovered ones remain. Arg.) I’m currently testing how best to do this. Here are three possible options:
    1. Turn off avahi-daemon altogether. Avahi is related to (the same as?) ZeroConf / Bonjour / Rendevouz / Auto-discovery. You’d think that you could turn it off with a simple:
systemctl disable avahi-daemon
but on reboot, it seems to be back in service. Flipping the bit in “/etc/default/avahi-daemon” doesn’t help either. You might have to tweak the avahi files in “/etc/init.d” to disable it.
    1. Tell Avahi to not publish on dbus the devices it finds. Edit “/etc/avahi/avahi-daemon.conf”, uncommenting the line under “[server]” that says “enable-dbus=yes”, and changing the “yes” to “no”.
    2. Tell the GTK-3 applications (like Firefox) to not use the devices published by Avahi. Create “/etc/gtk-3.0/settings.ini”, and add the following content to it:


(the default, without this setting, is "gtk-print-backends=file,cups)

Of these three methods, I’ve had the best results with “b”.

You should now be able to print to a Pharos printer from Linux. I edited the “/usr/local/bin/pharospopup” python script to swap out “myACU” for “myITT”, and to tweak the “release station” to “the Circulation Desk”. Now the popup is customized more specifically for my environment.

Wednesday, September 20, 2017

Biblical Complementarianism

N.T. Wright (whom I've never listened to before; didn't really know anything about him) is asked a question about "Gay Marriage", and presents a very interesting concept from a much wider view:

The Biblical design of our (pre-Fall original and future restored) cosmos is one of complementary contrasts:
  • Light - Dark
  • Day - Night
  • Heaven - Earth
  • Land - Seas
  • Birds (flying in air) - Fish ("flying" in water)
  • Male - Female
  • God (Christ) - Humans (Church)
  • New Heaven - New Earth
  • Lion - Lamb
  • Body - Spirit
This is the Design. Anything else is something other than the Design.