Prepare the development environment for keyhac for Mac

Background

I'm glad I got the new MacBook Pro, but since it's Sierra from the beginning, the question was what to do with Karabiner. First of all, I tried to move to Karabiner-Elements, but it failed, and it was a recourse keyhac for Mac .com / site / craftware / keyhac-ja) is also at a loss because the most important settings cannot be realized.

If Vim cannot be used as it is, it will lead to a gradual death, so fortunately I would like to improve keyhac whose source is open to the public to overcome it. Specifically, the goals are as follows.

Basically follow the wiki

https://github.com/crftwr/keyhac/wiki

Install Python 3.4.x and dependent packages

Prepare pyenv with anyenv and install Python 3.4.5 with pyenv. For the time being, I made it global without using virtualenv. Install the following packages listed on the wiki using pip3.4 (although if you specify 3.4.5 globally, pip is also 3.4.5).

keyhac and ckit should clone in the same hierarchy and check out the mac_port branch respectively.

build ckit

An error occurs when building ckit with Xcode.

Screen Shot 0028-11-10 at 21.56.36.png

Python header directory path resolution

I prepared a Python 3.4 environment using pyenv, so the cause is that the path to the header directory does not pass.

Screen Shot 0028-11-10 at 22.04.04.png

The original setting was /Library/Frameworks/Python.framework/Versions/3.4/Headers, but in the last few generations of macOS it has moved to /System/Library/Frameworks/Python.framework. There is. I wondered if I didn't need pyenv if there was 3.4 here, but when I looked at the destination, it was only up to 2.7, so pyenv wasn't wasted.

Change the header directory path to /Users/<username>/.anyenv/envs/pyenv/versions/3.4.5/include/python3.4m.

Screen Shot 0028-11-10 at 23.13.46.png

Redefinition of enumerator 'kVK_RightCommand'

/path/to/ckit/ckitcore/mac/ckitcore/ckitcore_hook_mac.cpp:49:5: Redefinition of enumerator 'kVK_RightCommand'

An error that looks like an enum duplicate definition. I commented out for the time being.

before.cpp


enum AdditionalVk
{
    kVK_RightCommand = 0x36,
};

after.cpp


enum AdditionalVk
{
    // kVK_RightCommand = 0x36,
};

Python dylib link error

There was an error in the link near the end of the build. Python in Support Files has a reference error and needs to be resolved. However, if you normally install Python with pyenv, only a static library will be generated, so if you want a dynamic link library, you need to install it with the --enable-framework option ([reference link](https:: https:: //github.com/yyuu/pyenv/issues/99)).

$ env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.4.5

After the installation is complete, Python.framework will appear under /Users/<username>/.anyenv/envs/pyenv/versions/3.4.5, so change the header directory and dylib path here.

The build will succeed once, but there is a warning that a directory that does not exist is specified at the time of linking. I was wondering where to set it, but I found the old path in TARGETS's Library Search Paths, so point it to pyenv's Python.framework.

Screen Shot 0028-11-11 at 0.49.06.png

Now the warning disappears and the ckit build is complete. There are two code warnings that haven't been reached yet, but ignore them for now.

Run keyhac

There was an instruction to make a symbolic link on the wiki, but ckitcore.so was created without doing anything, so I will start it.

$ python keyhac_main.py -d

Unfortunately, an error occurred again.

Traceback (most recent call last):
  File "keyhac_main.py", line 19, in <module>
    import keyhac_keymap
  File "/Users/kodama/Work/keyhac/keyhac_keymap.py", line 17, in <module>
    import accessibility
ImportError: No module named 'accessibility'

iTerm.app wasn't on the accessibility allow list, so I added it and re-run it, but I get the same error. Try installing accessibility with pip obediently.

$ pip install accessibility

You have successfully started keyhac.

Recommended Posts

Prepare the development environment for keyhac for Mac
Prepare the development environment with anyenv
Prepare the environment for Atom for Pythonista
How to prepare Python development environment [Mac]
Prepare the development environment for Python on AWS Cloud9 (pip install & time change)
Development environment suitable for ArcPy
Build a local development environment for Laravel6.X on Mac
Python environment construction For Mac
How to build a development environment for TensorFlow (1.0.0) (Mac)
Install Ubuntu 20.04 with GUI and prepare the development environment
[For organizing] Python development environment
python memo (for myself): About the development environment virtualenv
[Day 1] Prepare Django's development environment
Ansible environment construction For Mac
Prepare Python development environment with Mac + Windows + VisualStudio Code (Windows version)
Prepare Python development environment with Mac + Windows + VisualStudio Code (Mac version)
Prepare Python development environment on Ubuntu
Prepare your first Python development environment
Python development environment options for May 2020
Emacs settings for Python development environment
Python3 TensorFlow for Mac environment construction
Checking the NAOqi Python development environment
Prepare Python development environment with Atom
Continuation ・ Notes on preparing the Python development environment on Mac OS X
Mac OS X Mavericks 10.9.5 Development environment construction
Python development environment for macOS using venv 2016
Creating amateur python environment settings (for MAC)
[Mac] Building a virtual environment for Python
About the development environment you are using
Mac OS X Yosemite 10.10 Development environment construction
Mac OS X development environment construction memo
Construction of development environment for Choreonoid class
The strongest Python development environment PyCharm's recommendation
Building a Python development environment for AI development
Creating a development environment for machine learning
The strongest Python integrated development environment PyCharm
Prepare Python development environment for each project in Windows environment (VSCode + virtualEnvWrapper + Pylint)
Create a Python development environment locally at the fastest speed (for beginners)
Note: Prepare the environment of CmdStanPy with docker
Prepare the execution environment of Python3 with Docker
Build the fastest Django development environment with docker-compose
I want to create a nice Python development environment for my new Mac
Prepare a programming language environment for data analysis
Prepare the environment for O'Reilly's book "Deep Learning from scratch" with apt-get (Debian 8)
Building an environment for executing Python scripts (for mac)
Instantiation of the BOX development environment created earlier
[Blender] Prepare the Blender script debugging environment (Eclipse + PyDev)
I created a Dockerfile for Django's development environment
Python: Prepare a serializer for the class instance:
Building an environment for matplotlib + cartopy on Mac
Build a Python development environment on your Mac
Mac development environment construction (Ansible + Serverspec + Travis CI)
Build a Kubernetes environment for development on Ubuntu
Build a mruby development environment for ESP32 (Linux)
[Note] How to create a Mac development environment
Set up TinyGo development environment for VS Code
How to set the development environment for each project with VSCode + Python extension + Miniconda
Set up a development environment for natural language processing
I tried Python on Mac for the first time.
Building an environment for "Tello_Video" on Mac OS X
[For beginners] Install the package in the Anaconda environment (Janome)