I'm on MacOS X, and I'm pretty new to app-bundle-type things. I am writing a program that opens a window and registers mouse input -- not a command line tool. When I compile my code (written in C, if that is important) into an executable file (a 'unix executable file') and then run that file directly (by double clicking it, for example), a terminal window pops up, and then the program's window pops up. Likewise, if I navigate to the directory of the executable and open it from the command line, it pops open /another/ terminal window and then the program's window.
However, if I wrap the executable in a bundle (thus, I suppose, turning it into a proper 'app'), then when I run the app, either by double clicking or from the command line, the program's window opens and no new terminal window is created. Is this merely a property of the 'app bundle's architecture? Or is there a way that I can run the raw executable without incurring another terminal window? I suspect that I'm misunderstanding something fundamental. Thanks in advance!
- From talon import Module mod = Module # to reduce typing, you can reference the app registry through a local variable apps = mod. Fancyedit = ' os: mac and app.bundle: com.example.fancyedit os: windows and app.exe: fancyed.exe ' apps. Terminal = 'app.bundle: com.apple.Terminal' # you can specify the same app several times; this.
- Even without becoming an expert in Apple's Terminal app, you can use simple commands to achieve things your Mac won't let you do in any other way. If you're just getting used to Terminal.
- What is Terminal app? Terminal is a useful tool for executing commands on a Mac. However, many Mac users probably think that only people who have graduated from computer science can write something or use Terminal app. Considering that the overwhelming majority of users are doing their own things on the computer: play games, read books, surf the Internet, etc. And if someone knows a bit about.
The preferences dialog for Terminal.app in OS X 10.8 (Mountain Lion) and later offers choices for values of the TERM environment variable. Available options are ansi, dtterm, nsterm, rxvt, vt52, vt100, vt102, xterm, xterm-16color and xterm-256color, which differ from the OS X 10.5 (Leopard) choices by dropping the xterm-color.
I believe what you're seeing is correct. In order for a separate window to not pop-up, you'd need to encapsulate it into a bundle.
Launching by double-clicking a bundle, or using the 'open' command from Terminal uses Apple's Launch Services, which maintains a list of known (registered) applications. When an application (bundle) is introduced to the system, it is registered with Launch Services and associated with its URI (e.g. com.apple.calculator), which is present in the bundle's Info.plist
Other items in the Info.plist tell launch services how to handle the application, such as checking if the minimum or maximum version of the OS has been exceeded, or whether or not to display a dock item.
A lone binary doesn't have an associated Info.plist manifest, so its behaviour can't be varied and a Terminal window is opened.
Capitalize all files in a directory using Bash
osx,bash,rename
In Bash 4 you can use parameter expansion directly to capitalize every letter in a word (^^) or just the first letter (^). for f in *; do mv -- '$f' '${f^}' done You can use patterns to form more sophisticated case modifications. But for your specific question, aren't you..
How do i make a condition that will end the program, and prevent further cout statements?
c++,terminal
I would suggest you use switch case for the conditions and a while loop for the enter 1,2,3 thing. Something like bool running=true; while(running) { running = false; switch(i) { case 1: stuff; break; case 2: stuff; break; case 3: stuff; break; default: cout<<'enter 1,2,3'; running = true; } }..
Set CALayer Gradient Background
objective-c,xcode,osx,cocoa,cocoa-touch
CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.colors = [NSArray arrayWithObjects:(id)[[NSColor whiteColor] CGColor], (id)[[NSColor greenColor] CGColor], nil]; gradient.frame = self.colorView.bounds; [self.colorView setLayer:gradient]; [self.colorView setWantsLayer:YES]; ..
Is there a way to go two directories back in cygwin (linux)?
terminal,cygwin,cd
You can use pushd and popd. pushd adds a directory to stack, popd removes it. See man bash for details.
Change the “about this” window on mac app
java,osx,deployment
If your application is an .app bundle then it should have an info.plist. Inside the info.plist will normally contain version information that should display the version number: <key>CFBundleShortVersionString</key> <string>2.0.0</string> Typically the version information here is populated in places that call for it (eg. About). To change the name that would..
What is the best way to make sure I am not using any unavailable API's on OSX?
objective-c,xcode,osx,cocoa
For the moment, there's no easy way to do this, since as you said, 10.9 is the farthest back you can specify. Until Xcode 7 is released, which I believe will only help with more recent SDKs anyway, you have few choices, none at all convenient: Keep a cheap Mac..
How can I fix “Error: Formulae found in multiple taps”?
php,osx,homebrew,phpredis
brew untap josegonzalez/homebrew-php ..
How to get NSTableView to use a custom cell view mixed with preset cell views?
osx,swift,cocoa,nstableview,nstableviewcell
I'd try just giving the default cell your own identifier in Interface Builder.. ..then just use that in conjunction with makeViewWithIdentifier:: func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? { var viewIdentifier = 'StandardTableCellView' if let column = tableColumn { switch column.identifier { case 'nameColumn': viewIdentifier = 'nameCellView'..
Stuck with creating an event and formatting dates (Swift - EventKit - OS X)
ios,osx,swift,eventkit,ekevent
dateString doesn't match the format you specified. Why not use the built-in short style? This appears to work: let dateFormatter = NSDateFormatter() dateFormatter.dateStyle = .ShortStyle var dateString = '07/16/2015' var startDate = dateFormatter.dateFromString(dateString) var endDate = dateFormatter.dateFromString(dateString) startDate and endDate are optionals, so you'll have to unwrap them. In this..
How to display Apple San Francisco's numbers mono-spaced rather than proportionally?
osx,fonts,apple
Number formatting of an OpenType font requires having control over which features are active during text shaping, something which typesetting tools will offer (InDesign, XeLaTeX, etc), but which normal productivity tools still (after a decade of Adobe, Apple, and Microsoft all agreeing on using OpenType!) don't offer. Notes included. So,..
iOS : pod update (unable to find the utility “xcode-select”)
ios,xcode,osx,xcode6,cocoapods
First of all check you have to install command line or not. You can check this by opening Xcode, navigating the menu to Xcode > Preferences > Downloads > Components, finding Command Line Tools and select install/update. if you haven't find command line tool then you need to write this..
Why I'm getting different java versions
java,terminal,java-8
Could it be that you installed the JRE 8 update 45 but still have version 8 update 31 for JDK?
Using a command-line utility to perform the following map-updates
shell,command-line,awk,terminal
Macos xcode install. If order is not important, join and awk can do the job easily. $ join <(sort input.txt) <(sort mapping.txt) | awk -v OFS='|' '{for (i=3;i<NF;i++) print $2, $i OFS}' 103823054|001| 103823044|011| 103823044|012| 103823044|013| 103823064|011| 103823064|012| 103823064|013| ..
JSON in Python: encoding issue on OS X, no issue on Windows
python,json,windows,osx,encoding
I get your OSX failure on Windows, and it should fail because writing a Unicode string to a file requires an encoding. When you write Unicode strings to a file Python 2 will implicitly convert it to a byte string using the default ascii codec and fails for non-ASCII characters..
Macports switch PHP CLI version
php,bash,drupal,terminal,macports
Do not modify files in /usr/bin. That's Apple's turf, and there are always other possibilities to avoid changing things there, especially since Apple's next update will happily revert these changes again and scripts might rely on /usr/bin/php being exactly the version Apple shipped with the OS. Put the original binary..
CGDisplayCopyAllDisplayModes leaves out one valid mode
osx,swift,core-graphics
There's public API that's only documented in the header. CGDisplayCopyAllDisplayModes() takes an options parameter, which is a dictionary. The docs (and even the headers) say that it's unused and you must past NULL, but you can pass a dictionary with the key kCGDisplayShowDuplicateLowResolutionModes and value kCFBooleanTrue. The option name is..
django-admin startproject not working with python3 on OS X
python,django,osx,python-2.7,python-3.x
Recommended: Try using virtualenv and initiate your environment with Python3. Or a quicker solution is to use python interpreter directly to execute django-admin: <path-to-python3>/python /usr/local/bin/django-admin startproject mysite ..
xargs echo colored output
terminal,xargs
Perhaps this is for Linux (although OSX adds an interesting twist by reversing the roles of bash and echo). Linux's /bin/echo has a -e option which expands escapes of the sort you show, while some shells (such as dash, used in Debian) follow POSIX more closely, and do not do..
How to get CPU utilization in % in terminal (mac)
osx,terminal,cpu
This works on a Mac (includes the %): ps -A -o %cpu | awk '{s+=$1} END {print s '%'}' To break this down a bit: ps is the process status tool. Most *nix like operating systems support it. There are a few flags we want to pass to it: -A..
Mac OSX - Allow for user input in shell script via GUI or Prompt
osx,bash,shell
From what I understand I would recommend you look in to Applescript as this will allow you to have a GUI Interface as well as executing 'SHELL' commands. First of all I would open 'Script Editor' program that comes preinstalled on Mac's This is an example script which asks for..
Call to implicitly-deleted copy constructor in LLVM(Porting code from windows to mac)
c++,osx,c++11,compiler-errors,llvm
This line of code is very ambiguous: for (auto it : _unhandledFiles)//ERROR HERE auto uses template argument deduction, so std::string s; std::string& sr = sr; auto x = sr; in the above code x is deduced to be of type std::string, not std::string&. So your loop is equivalent to: for..
fatal error: limits.h: No such file or directory
xcode,osx,gcc
Make sure you've installed the xcode command-line tools: xcode-select --install (Accept the pop-up dialog.) That will install system headers into standard locations expected by tools like gcc, e.g. /usr/include..
ASP.NET vnext overriding status code set in controller. Is this a bug?
osx,asp.net-5,kestrel
The behavior of void returning action was recently changed to not convert to 204 status code. However, for you scenario you could use the CreatedAtRoute helper method(this actually creates a CreatedAtRouteResult) which sets the Location header. [HttpPost] public void Post([FromBody]CrudObject crudObject) { return CreatedAtRoute(routeName: 'GetByIdRoute', routeValues: new { id =..
Binding an NSTableView to an array of strings in Swift
osx,swift,cocoa,nstableview,cocoa-bindings
The Class Name should absolutely be set to a valid class. The bigger problem is that the array controller doesn't really play nicely with arrays of strings. There's no (reasonable) way to use -setValue:forKey: on a string since the string is itself what's being edited (replaced), not some property (like..
Crash when processing `__Atom` class object in Objective C (using Objective C runtime )
objective-c,osx,objective-c-runtime
+[NSObject isSubclassOfClass:] is a class method for NSObject and not all classes are subclasses of NSObject. It seems as if you have find private class that is not a subclass of NSObject, so it requires a more delicate handling for checking for inheritance. Try: BOOL isSubclass(Class child, Class parent) {..
pcap_dispatch() always returns 0 on Mac OSX for wifi interface
osx,pcap,libpcap,arp
If you are capturing in monitor mode, you will be getting native 802.11 packets, which do not look like Ethernet packets, so filtering similarly to Ethernet will not work. Furthermore, if you're capturing in monitor mode on a protected network, i.e. a network using WEP or WPA/WPA2, everything past the..
Simulating HID on OSX : IOBluetooth or CoreBluetooth?
ios,osx,core-bluetooth,iobluetooth
CoreBluetooth is for Bluetooth low energy (BLE), whereas IOBluetooth is for classic Bluetooth. iOS devices can connect to HID devices over either transport: the BLE profile is called HOGP: HID over GATT Profile. CoreBluetooth/BLE should be easier to work with, but you'll still need to implement the HID protocol yourself..
Use Unix Executable File to Run Shell Script and MPKG File
osx,shell,unix
The most common issue when handling variables containing paths of directories and files is the presence of special characters such as spaces. To handle those correctly, you should always quote the variables, using double quotes. Better code would therefor be: sudo sh '$path/join.sh' sudo sh '$path/join2.sh' It is also advised..
Display django runserver output from Vagrant guest VM in host Mac notifications?
python,django,osx,notifications,vagrant
Why not run a SSH server on the VM and connect from the host via a terminal? See MAC SSH. Which OS is running on the VM? It should not be too hard to get the SSH server installed and running. Of course the VM client OS must have an..
Eclipse CDT - No Console Output on OSX
c++,eclipse,osx,terminal,64bit
Are you using the right compiler? If you are compiling with Cross GCC it might not run on a 64bit OS X device. Try using MacOS GCC for compiling if so.
How to exit if statement in bash without exiting program?
bash,terminal
First: Don't do any of this. Structure your program some other way. If you described to us why you think you need this behavior, we could potentially have told you how to achieve it otherwise. Getting down to the question: If you wrap your block in a loop, you can..
OSX tmux configuration session open file in vim automatically
osx,session,vim,configuration-files,tmux
Explicitly inserting a space should do it: send -t 1 vim space ~/Path/to/my/file enter or you can quote command arguments (I prefer this one): send -t 1 'vim ~/Path/to/my/file' 'enter' ..
Login with Facebook option trigger suggest to download an app
android,ios,facebook,osx,login
I found out what I was talking about. How to undo in mac contacts app. Facebook is adding a new feature which ask users if they want to get a link to the mobile app. This is in Beta right now but you will automatically eligible for the feature if: You have integrated the new Facebook Login..
How to programatically make a key shortcut?
osx,bash,task-switching
You can use Applescript to achieve this. To focus on a specific application: tell application 'Finder' to activate And to emulate an actual Cmd+Tab input: tell application 'System Events' key down command keystroke tab key up command end tell Applescript files (*.scpt) can be run through the command line with..
Initializing a xib view as a subview of another NSView
objective-c,osx,cocoa,xib,nib
You could use the loadNibNamed:owner:topLevelObjects: method. Here's an example: NSArray *views = nil; [[NSBundle mainBundle] loadNibNamed:@'TestView1' owner:nil topLevelObjects:&views]; [self.view addSubview:[views lastObject]]; The above code will load the top-level contents of the XIB into an array. Per the documentation: Load a nib from this bundle with the specified file name and..
Run Boot2Docker from bash
osx,bash,docker,boot2docker
Replace your boot2docker start with boot2docker start && $(boot2docker shellinit) and you are good to go. $(boot2docker shellinit) will export all the Environment variables needed.
How to uninstall all python versions and use the default system version of OS X 10.10?
python,osx
The file /usr/bin/python (and /usr/bin/pythonw, which is a hard link to the same file) is actually a launcher program that invokes the default version of Python from /System/Library/Frameworks/Python.framework/Versions. You can select the version (2.6 and 2.7 in Yosemite) the launcher invokes using either the defaults command or the VERSIONER_PYTHON_VERSION environment..
Using subprocess.check_output for a command with 2>/dev/null
python,osx,subprocess
For 2>/dev/null, the appropriate way to control redirection of file descriptor 2 with the subprocess.Popen family of calls is stderr=: # Python 2.x, or 3.0-3.2 output = subprocess.check_output(['du', '-g', '-d1', '/Users'], stderr=open('/dev/null', 'w')) ..or, with a Python supporting subprocess.DEVNULL: # Python 3.3 or newer output = subprocess.check_output(['du', '-g', '-d1', '/Users'],..
How do you work with views in MainMenu.xib?
objective-c,xcode,osx,cocoa
So the default is that your main application window is an outlet in the app delegate. You should keep MainMenu.xib's owner as the app delegate. A common alternative, if you are creating your own custom window controller, is to create a property in the AppDelegate of type CustomWindowController, then in..
What's the shortcut to interrupt the kernel in Canopy?
osx,kernel,interrupt,shortcut,canopy
There is no shortcut for interrupting the kernel. That command, along with restarting the kernel, is in the Run menu, which also shows the shortcut for the restart kernel command. Note that because of the nature of the interaction between Python and C extensions, neither command is guaranteed to work,..
Restrict input on NSTextField
osx,swift,cocoa,nstextfield
You have complete control with a subclass of NSFormatter. I'm not sure why you think you don't. Override isPartialStringValid(_:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:) and implement the desired logic. From the docs (with some minor edits by me): In a subclass implementation, evaluate [the string pointed to by *partialStringPtr] according to the context. Return YES..
loop through different arguments in Rscript within Korn shell
r,terminal,ksh
You need to do two things: Create an array of all your input variables Loop through the array and initiate all your calls The following illustrates the concept: #!/bin/ksh #Create array of inputs - space separator inputs=(Input1 Input2 Input3 Input4) # Loop through all the array items {0 .. n-1}..
Change NSTextField border and BG color while editing
osx,swift,cocoa,nstextfield
You can set the delegate of NSTextField: nameTextField.delegate = self then you can set a different state: func control(control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool { nameTextField.bezeled = true nameTextField.backgroundColor = NSColor.textBackgroundColor() return true } func control(control: NSControl, textShouldEndEditing fieldEditor: NSText) -> Bool { nameTextField.bezeled = false nameTextField.backgroundColor = NSColor.windowBackgroundColor()..
ffmpeg: wmv files generated on Mac can't be played in Windows
windows,osx,ffmpeg,file-conversion,wmv
You can try a codec for encoding instead. Try this. ffmpeg -i input_gif -b:v 2M -vcodec msmpeg4 -acodec wmav2 output_wmv You may find this important..
Native Code: cannot use typeid with -fno-rtti
c++,osx,gcc,android-ndk,vtk
To enable C++ in the NDK, add LOCAL_CPP_FEATURES := rtti exceptions and LOCAL_CPPFLAGS += --std=c++11 to the jni/Android.mk file. By default, the NDK supports only a C++-like language. Note that there's no underscore between CPP and FLAGS. Also, I've used += because this won't overwrite other flags such as -Wall..
Read plist inside ~/Library/Preferences/
Mac Terminal Download
objective-c,xcode,osx
You need to use NSString method: stringByExpandingTildeInPath to expand the ~ into the full path. NSString *resPath = [@'~/Library/Preferences/' stringByExpandingTildeInPath]; NSLog(@'resPath: %@', resPath); Output: resPath: /Volumes/User/me/Library/Preferences ..
Mac Software Bundle
How can I run the Jenkins jobs through terminal?
jenkins,terminal
There are few ways to trigger a Jenkins build from command line: Remote access API is offered in a REST-like style: Job without parameters: curl -X POST JENKINS_URL/job/JOB_NAME/build --user username:token Job with parameters: curl -X POST JENKINS_URL/job/JOB_NAME/build --user username:token --data-urlencode json='{'parameter': [{'name':'id', 'value':'123'}, {'name':'verbosity', 'value':'high'}]}' Jenkins CLI -..
best way to create a mat from a CIImage?
c++,xcode,osx,opencv,opencv3.0
Mac Os X Terminal App
Found a solution to get rid of the crash: use createCGImage:fromRect to skip the NSBitmapImageRef step: - (void)OpenCVdetectSmilesIn:(CIFaceFeature *)faceFeature usingImage:ciFrameImage { CGRect lowerFaceRectFull = faceFeature.bounds; lowerFaceRectFull.size.height *=0.5; CIImage *lowerFaceImageFull = [ciFrameImage imageByCroppingToRect:lowerFaceRectFull]; // Create the context and instruct CoreImage to draw the output image recipe into a CGImage if( self.context..