Friday, 1 June 2018

How to fix kernel_require.rb:55:in `require': cannot load such file -- xcodeproj (LoadError)

Problem:

When I try to build and deploy in XCode 9.3, I get the following error related to: "kernel_require.rb:55:in `require': cannot load such file -- xcodeproj (LoadError)"

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj (LoadError)
 from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /Development/ELD.iOS/ELD/Scripts/generate_resources.rb:4:in `
' Command /bin/sh failed with exit code 1

Possible solutions to try:

There are several possible ways to address this issue. Two are listed here to try.

  1. Install XCode command line tools from Apple
  2. Install the gem "xcodeproj"

To install XCode command line tools...

  1. Go to https://developer.apple.com/download/more/ and login
  2. Search for the command line tools for your version of XCode, download it, then install it.

To instead install the gem "xcodeproj"...

  1. Open a Terminal window
  2. Use the command:
    sudo gem install xcodeproj

Notes:

This how-to was tested to work for a project on macOS High Sierra 10.13.4 and XCode 9.3. Your results may vary. It assumes a little working knowledge of XCode and Terminal.

Best of luck!

Tuesday, 30 January 2018

Cannot type into Spotlight in macOS

Problem:

I suddenly cannot type anything into Spotlight.

It opens and closes, and even does so with the Command-Space shortcut. I just can't type in it when it's open.

Workaround:

  • Open Terminal
  • Use the following command:
    killall Spotlight
  • If all goes well, the magnifying glass for Spotlight will disappear and reappear, and you'll be able to type into Spotlight again

Notes:

This was tested to work in macOS 10.12.6.

Wednesday, 24 January 2018

Seamonkey XPCOMGlueLoad error

Problem:

I updated Seamonkey on Linux Mint and it now won't launch. I am running a 64-bit version of Linux Mint.

In terminal, I tried to run Seamonkey but got an error similar to:

$ /path/to/seamonkey/seamonkey

XPCOMGlueLoad error for file /path/to/seamonkey/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

When checking, I do have GTK 3:

$ locate libgtk-3.so.0

/usr/lib/x86_64-linux-gnu/libgtk-3.so.0
/usr/lib/x86_64-linux-gnu/libgtk-3.so.0.1800.9

Solution:

It may be that you're attempting to run a 32-bit version of Seamonkey on 64-bit Linux Mint. The default Seamonkey download from Mozilla as of Jan 2018 is the 32-bit version.

You can find the 64-bit version in their releases page: http://archive.mozilla.org/pub/seamonkey/releases/

For example, for 2.49.1:

Notes:

This solution worked for Seamonkey 2.49.1 running on 64-bit Linux Mint 18.1 Serena as of Jan 2018. Your mileage may vary with other versions and configurations.

Also for the system tested, the auto-update is not an issue because this browser will only be used on a local network. (You'll see the note from Mozilla when you launch the browser... at least for version 2.49.1). Keep this in mind if your situation is different and you need a browser that reliably auto-updates.

References:

http://archive.mozilla.org/pub/seamonkey/releases/ http://forums.mozillazine.org/viewtopic.php?f=40&t=3005417

Tuesday, 16 January 2018

XQuartz move offscreen windows back on-screen in macOS/OS X

Problem:

I have several XQuartz/X11 windows in macOS/OS X that are offscreen. I want to move them on-screen so I can save my work.

Example scenario:

You can create an example of off-screen X11 windows when using macOS/OS X with an external monitor and a screen geometry where one monitor is higher and further left to another (scroll down to see a screenshot example).

In the lower-right monitor, when opening certain windows in programs like Inkscape, those windows will be created at coordinate that you cannot access with your mouse cursor.

Workaround:

Pre:

  • If not already installed, then install xdotool (easiest way is to use Homebrew)

To find out window ids and geometry:

  • In Terminal, you can use:
    xwininfo -tree -root
  • If you want to filter by an application, you can pipe to grep, for example:
    xwininfo -tree -root | grep "inkscape"

To move a window to a visible coordinate:

  • If not already installed, then install xdotool (easiest way is to use Homebrew)
  • Make note of a valid coordinate. Use the output of xwininfo from the above step to find a visible top-left coordinate for your window (e.g. it can be an existing window that you can already see and use with your mouse. In the screenshot below, a visible coordinate is 1070 1102)
  • In Terminal, use the following command and replace [options] [window] [x] [y] with the appropriate values:
    xdotool windowmove [options] [window] [x] [y]

Example:

Consider the following window geometry:

Inkscape has spawned the "document properties" window to a coordinate that is out of desktop 1:

Use xwininfo to find out window IDs, geometry, as well as to to find a set of on-screen coordinates:

Use xdotool to move off-screen window to an on-screen coordinate on desktop 1:

If all goes well, the window should now be visible.

Now would be a good time to save your work.

Also note that there might be some unexpected behaviour for XQuartz windows moved this way (e.g. "show all windows" still shows incorrect placement, etc.)

Where to go from here?

Some ideas:

  • write a script to automatically collect all windows of a certain app into visible coordinates if they're not visible
  • if you're able to and have the time to volunteer, contribute to the XQuartz project a feature to collect or clamp all windows to a given desktop :) (thanks in advance!)

Notes:

This workaround was verified to work with macOS Sierra 10.12.6, XQuartz 2.7.11, xdotool 3.20160805.1. Other versions may have different results.

References:

Monday, 15 January 2018

Exit XQuartz Full Screen Mode macOS Sierra

Problem:

How do I exit XQuartz full-screen mode?

Solution:

When in XQuartz:

  • Press the keyboard shortcut Command-, (command + comma)
  • Uncheck full-screen mode in the preferences

References:

Friday, 12 January 2018

How to take Touch Bar screenshots on Mac

Problem:

How do I take a screenshot of the Touch Bar on a Mac?

Solution:

To take a Touch Bar screenshot and...

  • ...save as a file on the desktop: Shift-Command-6
  • ...copy to clipboard: Control-Shift-Command-6

Example Screenshot:

Notes:

The shortcuts in the solution above are defaults. They can be configured by going to "System Preferences" -> Keyboard -> Shortcuts -> "Screen Shots", and setting new shortcuts.

The how-to was verified to work in macOS 10.12.6 on a MacBook Pro with a Touch Bar. Your mileage may vary with other OS versions.

References:

Thursday, 11 January 2018

USB-to-Serial on OS X/macOS - an Example

Problem:

I have a USB-to-Serial adapter that I need to use on a Mac. How do I configure it, and how do I read/write to it?

I am already partially familiar with using serial ports on Linux and Windows.

Notes:

This post is written as a reminder and contains just enough information to reproduce these steps in the future. It is not thorough. A little Google may be required in order to clarify or expand on some points.

The following steps were verified to work with macOS 10.12.6, with a very specific USB-to-serial adaptor that happened to work fine with Apple's default drivers. Your mileage may vary with other configurations and devices.

Steps Overview:

  1. Before you start, if drivers do not already exist then install them.
  2. Plug USB-to-Serial adaptor into your Mac
  3. Find info in "About this Mac" - More below
  4. Setup null modem and speed using Network Preferences - More below
  5. Find the device's path to access the Linux/POSIX way - More below

Step: Find adapter info:

To find out some basic information about your USB-to-Serial adapter, use the following steps.

  1. Go to "About This Mac" and click "More Info..." or "System Report..." (depending on your OS version)
  2. Find your device in the system report under "USB", and make note of what is there. This will help you identify your device in other steps.

Step: Configure serial communication using Network Preferences

To configure your USB-to-Serial adapter speed, etc., for use with other apps on your Mac, use the following steps.

  1. Open "System Preferences" and open the "Network" preferences pane
  2. Select your USB-to-Serial adapter if it is in the list, or add it then select it
  3. Click "Advanced..."
  4. Configure as null modem with the desired baud rate. The example screenshot below shows the attached device configured to 9600 bps (as well as some other configuration)

Step: Access your usb-to-serial port the Linux/Posix way:

  • to find the path to your serial port, in Terminal type in the following command and find your device:
    ioreg -c IOSerialBSDClient | grep usb
  • in the example screenshot above, the serial port is "/dev/cu.usbserial-FTAN3DQ" and an example of its use in VirtualBox is shown in the screenshot below.
  • (optional) to test your serial port directly, you can use the "screen" command in Terminal. More on this command in Apple's screen man page

    References:

  • How to change Ubuntu timezone to UTC

    Problem:

    How can I change my timezone to UTC in Ubuntu?

    Solution:

    1. In a terminal window type:
      sudo dpkg-reconfigure tzdata
      
    2. Then select "None of the above":
    3. After that, select "UTC":

    If all goes well then the "date" command should show the date and time in UTC.

    References:

    Friday, 17 November 2017

    Run gpsfeed+ in Lubuntu 16.04

    Problem:

    I would like to run gpsfeed+ in Lubuntu 16.04.

    I am running Lubuntu in VirtualBox. I want to output to guest COM1, and send this feed to a physical serial port on COM6 on my host machine.

    Solution:

    To run first time:
    1. download the gpsfeed+.tcl script
    2. open terminal
    3. install "wish" (in terminal: sudo apt-get install tk)
    4. install "libudp-tcl" (in terminal: sudo apt-get install libudp-tcl)
    5. (in terminal, navigate to folder where gpsfeed+.tcl script is)
    6. run gpsfeed+.tcl script (in terminal: wish gpsfeed+.tcl)

    To output to COM1 in Lubuntu VirtualBox guest:

    1. open VirtualBox settings for your guest machine
    2. navigate to "serial ports" and enable COM1
    3. to send the guest COM1 to a host serial port, configure port mode to send to host (for instance, to pipe to COM6 on a Windows host, use the settings in the screenshot below)
    4. in gpsfeed+: go to Connection->Serial/IP, and set Port to "/dev/ttyS0" (see this stack exchange question on how to find your serial ports in Linux)
    5. if needed, you may need to give read/write privileges to ttyS0 in terminal (make sure you know the implications first, or google them). One way is to add your user to the dialout group: "sudo usermod -G dialout -a (your username here)"
    6. if all works then you should see the NMEA sentences being sent to your serial port after starting the simulation in gpsfeed+
    VirtualBox settings to enable COM1 in guest and send to COM6 on host:
    Gpsfeed+ setting to send to COM1 in VirtualBox Lubuntu:

    Notes:

    These instructions were found to work using a Windows 10 host, VirtualBox 5.1.30, Lubuntu 16.04.1 32-bit, and gpsfeed+ v0.58. A physical serial port exists on COM6 on the host machine. With other settings, your mileage may vary.

    References:

    Wednesday, 23 August 2017

    Rename local git branch

    Problem:

    How do I rename a local git branch using git command line?

    Solution:

    If you'd like to rename the currently checked-out branch to "new_branch_name":

    git branch -m new_branch_name
    

    If you'd like to rename any branch ("old_branch_name") to "new_branch_name":

    git branch -m old_branch_name new_branch_name
    

    References: