OS X, previously Mac OS X, is a series of Unix-based graphical interface operating systems developed, marketed, and sold by Apple Inc. It is designed to run exclusively on Mac computers, having been pre-loaded on all Macs since 2002. Use this tag for questions about OS X specific code.

learn more… | top users | synonyms

4
votes
2answers
90 views

MacPorts - Quick Install Script

I wrote this script to automatically install the relevant version of MacPorts. It's supposed to be used in a fashion similar to the official installer for HomeBrew. FYI: The real reason that I ...
3
votes
0answers
52 views

Mounting a disk with the DiskArbitration framework

I have the following code that makes use of the DiskArbitration framework to mount a disk to its default location: ...
1
vote
1answer
141 views

Python implementation of Netcat, new design

I've made a simple netcat in Python and would appreciate any advice/opinions of how I've implemented it. test.py: ...
0
votes
0answers
51 views

Resolving the path to a Bash script

I wrote a function to resolve the full path to the current Bash script, and I'm wondering if it's SOLID: ...
4
votes
1answer
41 views

Search and merge split-archive backup parts

I wrote some code which searches parts of a split-archive backup (it's an Android backup, I used flashfire to backup) and rejoins them. As you can easily see, I've achieved this by ...
4
votes
1answer
44 views

Auto move files to a sub folder with Ruby

I started writing a script to handle my file downloads in osx because they quickly pile up and it gets time consuming to do this manually by drag and drop. I am looking forward to get some feedback. <...
1
vote
2answers
64 views

Lower the volume of my computer over time in Python

I wrote a program to gradually lower the volume of my computer when I go to sleep so I can fall asleep with TV or music on. This was my first time using argparse and I feel like there should be a ...
3
votes
0answers
1k views

Multiple View Controllers in a Single Window (Swift on OS X)

As an exercise I want to have a single window application (in Swift on Mac OS X) with 4 views, each controlled by an independent view controller and have their own XIB file. I have working code, but I ...
2
votes
1answer
78 views

Looking for identical files (or directories) in a filesystem

Dilemma The code below is in its infancy, but for now is an effort to crawl my entire file system and find duplicates whilst adhering to a variety of exclusion criteria. My current strategy for ...
5
votes
2answers
80 views

SSH chatting tool

I have taught myself some bash and already knew some AppleScript, so I have come up with this SSH chatting tool for OS X users. It allows you to chat from a terminal to another OS X computer. One ...
0
votes
1answer
398 views

Frontmost window of the current application that passes a predicate check

After resigning active state (going to the background), the mainWindow property of the main window in the app returns false. Nevertheless, I need a to find that ...
7
votes
1answer
14k views

Pure Swift solution for socket programming

I have spend quite some time now to find out how exactly to do socket programming in Swift (Xcode 6.1). There are a few examples out there, but most of them no longer work for the latest release of ...
6
votes
1answer
67 views

Reading OS X file tags

I'm investigating Go for use in our internal network / office project management system, and need a way to check and edit the color tags that you can set in Finder on files or folders (extended ...
6
votes
1answer
4k views

Timer UI-updating implementation for educational purposes

I thought it would be helpful to put together an example of what I'm talking about in the second part of my answer to this Stack Overflow question. The idea is that there's some data that is updated ...
3
votes
1answer
387 views

Bash functions to run/manage MySQL, Redis, Sidekiq, Rails server

I'm working with a Rails app that requires a few layers of infrastructure to run: MySQL, Redis, Sidekiq, and (of course) the Rails server. I wrote some functions to help me manage the various servers (...
5
votes
1answer
2k views

Python script using distutils to copy files on a Mac

I have a Python script I have written to copy files to a mounted Windows SMB share on a Mac. ...
5
votes
1answer
2k views

Presenting modal dialogs from XIB in Cocoa: best/shortest pattern?

Below is my typical WindowController module for presenting a modal dialog (could be settings, asking username/password, etc) loaded from a XIB. It seems a bit too complex for something like this. Any ...
9
votes
1answer
3k views

Canonical Implementation of a Subclass of NSOperation

I would like to develop a kind of template or canonical implementation for a concurrent subclass of NSOperation. Edit: there is a related request which implements ...
4
votes
1answer
179 views

Change whether file is executable

This is a cocoa app that adds a right click menu option to change whether a file is executable. It works by executing the system command chmod on each of the files. ...
2
votes
1answer
747 views

Reviewing C function which captures the screen

I have created a function in C on OSX in Xcode which captures the screen, adds the mouse pointer to the image, rescales the image to fit a certain width X height requirement, and puts the rescaled ...
4
votes
1answer
392 views

AppleScript to close running processes

I've been trying to emulate MS Windows behavior on my OS X and close processes that do not have a window. What I'd really like to do is "quit" the process on clicking the red "x" button. Instead, I'...
3
votes
2answers
374 views

Shell script to copy video files to another folder

I recently started running but hate running both in the quiet and with music, so i've been listening to podcasts. Unfortunately, I've caught up with all my favorites and so I've started listening to ...