Tag Archives: macOS

_LSOpenURLsWithCompletionHandler() failed for the application xxx with error -10671 [Solved]

Problem description

After updating the macos system and turning off SIP in mbp version 2022, the applications on the ipad installed on the system do not start properly and the following error is reported when running the open command in the terminal:

longyudeMacBookPro:~ longyu$ open -a "xxx"
_LSOpenURLsWithCompletionHandler() failed for the application /Applications/xxx.app with error -10671.
longyudeMacBookPro:~ longyu$

Note: The program name is for example only.

Equipment model and version information

mbp 2022

mac version: macOs Monterey version 12.6

 

Resolution process

  1. Checked app permissions – no exception found
  2. Tried to change application permissions – still can’t start after changing
  3. Check if there is already a process running – open activity monitor, no relevant process found
  4. Think about the items that the system modifies when it works and when it does not work
  5. Suspect a relationship with the SIP configuration.

 

Solution:

When the computer is shut down, long press the shutdown key to enter the recovery mode, open the terminal, execute csrutil enable to enable SIP, and restart the system. After re-entering the system, the program starts normally.

 

Other problems:

I searched the web for the return value of _LSOpenURLsWithCompletionHandler and did not find the meaning of the -10671 return value. The original intention of closing SIP was to use dtrace, a long-known program, normally, but since it has such a side effect after closing it can only be opened temporarily for fun, not all the time.

[Solved] Message from debugger: debug-server is x86_64 binary running in translation, attached failed.

After transferring an Xcode project from an Intel Mac to an Apple M1 chip, code compiles successfully on the M1 chip, but displays the following error at runtime:

Message from debugger: debug-server is x86_64 binary running in translation, attached failed.

insert image description here

Solution:

I have checked Xcode’s “Open with Rosettea” option, but it still doesn’t work successfully on the M1 chip. So this program doesn’t work for me. . .
insert image description here
Valid solutions:
Find Edit Scheme -> Run -> Debug excitable, Cancel this option to run successfully.
insert image description here
Note: If this method fails to Solve your problem, Please refer to the link below:
debugserver is x86_64 binary running in translation, attached failed. Could not attach to pid

[Solved] Mac Notebook M1 Chip Install Hashlips library npm error

Mac notebook M1 chip installs Hashlips library npm error problem

Foreword

When generating NFT, we often prepare all the materials needed for NFT, and then stack each material on the same canvas to generate an NFT, but if we manually It’s too troublesome to stack one by one, because NFTs are often issued in thousands of ten thousand, so manual generation is unrealistic, So what can we do to generate It, Is to use the computer, There are many similar tools on the Internet, There are graphical and pure code, And many use Paython to generate NFT, But there is a node abroad The script tool Hashlips can directly use node to generate, and it is very convenient and powerful to use, There was no problem when using the windows system before, After changing the MBP later, I found that Hashlips reported an error when executing npm install

image-20220913144839078

Cause Analysis

After various searches and research, I found that Hashlip is implemented with canvas canvas, Then I touched the node-canvas library, There is a very similar problem in the issue of this library, which probably means that the Mac with m1 chip cannot directly use npm to install the library to node-canvas, You need to use Homebrewto install what you need.

image-20220913145139869

Solution

Official solution

In fact, both node-canvas and hasllips have released solutions one after another,The solution is actually the same,The following is hasllips The method approved in the official issue

The correct method is as follows:

1. Download and install Node.js "Current" version, as opposed to the "LTS" (Long Term Support) version. This is now v18.0.0 as of the time of this post , but 17.x will work as well:
2. Ensure you have homebrew installed. You can go to or just use this command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install .sh)" to install Homebrew.
3. Install the dependencies via Homebrew using this command: arch -arm64 brew install pkg-config cairo pango jpeg giflib librsvg
4. In your root folder for the art engine project, install the project: npm install

The correct way is as follows:

1. Download and install the latest version of Node.js , instead of the "LTS" (Long Term Support) version.
2. Install Homebrew.
3. Install dependencies via Homebrew using the following command :arch -arm64 brew install pkg-config cairo pango jpeg giflib librsvg
4. In the root folder of your art engine project ,install the project:npm install

My solution

Combined with the above solution, The landlord did not upgrade the node version to the latest version, but used the LTS long-term support version of Node16.6, then Directly use Homebrew to execute the command brew install pkg-config cairo pango libpng jpeg giflib librsvg pixmaninstall

Wait for the above installation to complete,npm install or yarn install directly in the project

[Solved] Vscode1.71.0 terminal error: `sed: illegal option — r`

Problem description

In the Mac environment, the terminal that comes with Vscode will show a sed prompt no matter what command it is.,There is no problem with using the built-in terminal

$ echo 'hi'
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ... ]
hi

System Environment

# system version
$sw_vers

ProductName: Mac OS X
ProductVersion: 10.14.4
BuildVersion: 18E2035

# vscode version
$ code -v
1.71.0
784b0177c56c607789f9638da7b6bf3230d47a8c
x64

Solution

Refer to the issue for a good solution to this problem

The official website also said that this problem will be fixed in the next version

Modify file /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh

Replace line 125

# __vsc_current_command="$(builtin history 1 | sed -r 's/ *[0 -9]+ +//')"
__vsc_current_command="$(builtin history 1 | sed -E 's/ *[0-9]+ +//')"

Mac: make: *** [Zend/zend_language_parser.lo] Error 1

Error reporting content:

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1317:5: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                                yystpcpy(yyres, "end of file");

                                ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1317:5: note: did you mean 'stpcpy'?

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:130:7: note: 'stpcpy' declared here

char    *stpcpy(char *__dst, const char *__src);

         ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1324:29: error: implicit declaration of function 'yystrlen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                yystr_len = (unsigned int)yystrlen(yystr);

                                          ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1324:29: note: did you mean 'strlen'?

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:82:9: note: 'strlen' declared here

size_t   strlen(const char *__s);

         ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1345:4: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                        yystpcpy(yyres, buffer);

                        ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1352:10: error: implicit declaration of function 'yystrlen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                return yystrlen(yystr) - (*yystr == '"' ?2 : 0);

                       ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1365:2: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

        yystpcpy(yyres, yystr);

        ^

5 errors generated.

make: *** [Zend/zend_language_parser.lo] Error 1

Implicit declaration of function ‘yystpcpy’ is invalid in C99. Looking up information on the Internet, we can find that this error type is related to the header file or the previous define. From the prompts in the error report, we can see that the function yystpcpy is missing.

Access the file php-src/Zend/zend_language_parser.c. You can see this code below:

Add the definitions of yystpcpy and yystrlen to it, guess that their original functions should be stpcpy and strlen functions: re-make after modification, and compile successfully.

[Solved] Mac Terminal error: command not found: telnet

When a new Mac computer is purchased, an error is reported when the telnet command is used at the terminal: command not found: telnet. This is because telnet is not installed at the terminal.

Solution:

brew install telnet

If homebrew is not installed on the terminal, install homebrew first

 /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )”

Then install telnet

 brew install telnet

[Solved] Mac git clone error:xcrun:error:invalid active developer path(/Library/Developer/CommandLineTools)

Background

After upgrading the MAC system, using git clone and other related commands on the terminal fails with an error

xcrun:error:invalid active developer path(/Library/Developer/CommandLineTools),missing xcrun at:/Library/Developer/CommandLineTools/usr/bin/xcrun

Troubleshooting

1. Check whether git has been installed

# command
which git

# outcome
/usr/local/bin/git

Description git has been installed

2. View git help information

git --help

Error reporting is the same as above:

xcrun:error:invalid active developer path(/Library/Developer/CommandLineTools),missing xcrun at:/Library/Developer/CommandLineTools/usr/bin/xcrun

to sum up, GIT has been installed, but the GIT command cannot be used normally. It may be that the GIT installation package is damaged, so reinstall git

3. Reinstall Git

brew install git

The following error messages appear during installation:

Error: The following formula:
  git
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:
  xcode-select --install

Error: Git must be installed and in your PATH!
Error: The following formula:
  git
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:
  xcode-select --install

according to the prompt, you need to reinstall xcode-select

Solution: install xcode-select

To sum up, we need to reinstall xcode-select and execute the following commands on the terminal

 xcode-select --install

After installation, perform the following:

git --help

The correct output of information indicates that git has returned to normal and can be used

 

Mac HarmonyOS Failure[INSTALL_PARSE_FAILED_USESDK_ERROR]

In the MAC environment, during the development of HarmonyOS, the project runs to the simulator and reports the following errors:

Failure[INSTALL_PARSE_FAILED_USESDK_ERROR]

compileSdkVersion and releaseType of the app do not match the apiVersion and releaseType on the device.

Operation steps.

I. If the HDC tool environment variables are not configured, configure them as follows, and skip this step if they have been configured.

1. Open Mac terminal and enter the following command to open the bash_profile file.

open .bash_profile

2. In the bash_profile file, configure the environment variables, here the PATH path, refer to your own sdk path, version 3.0.0.1 is the version corresponding to Toolschains under API Version7 in my own SDK, the value is 3.0.0.1.

export PATH=$PATH:/Users/tangkun/Library/HarmonyOS/Sdk/toolchains/{3.0.0.1}
export CLASSPATH
HDC_SERVER_PORT=7035
launchctl setenv HDC_SERVER_PORT $HDC_SERVER_PORT
export HDC_SERVER_PORT

3. Save the configured environment variables and enter the following command in the open terminal.

source .bash_profile

4. Restart the development tool DevEco-Studio.

Second, the following is the operation of configured HDC environment variables:
In the terminal terminal of DevEco-Studio, enter the following command:

. /hdc shell

(Windows environment does not need the previous . /hdc shell)

Next, enter the following command in the terminal, but this time you do not need to enter . /, in terminal my Huawei emulator output 6.

getprop hw_sc.build.os.apiversion

This apiversion version number 6 is smaller than the version number 7 in my project’s build.gradle and project’s build.gradle, so it causes my project to run on this apiversion version 6 emulator with the following direct error.

The version numbers of entry and application in the build.gradle:
compileSdkVersion 7 and compatibleSdkVersion 7

Solution:

1. lower the compileSdkVersion and compatibleSdkVersion version numbers in the build.gradle file of entry and application to 6.

2. Use an emulator with Api 7 for debugging.

How to Solve MacOS ffmpeg killed Error


tags: MacOS Debug Tips

Question

Recently, I wanted to download the live playback course in nailing with the tried and true method, but some errors suddenly appeared when executing ffmpeg on the command line:

[1]    40344 killed     ffmpeg

 

Solution:

This problem can be solved by compiling and installing from the source code through the following command

brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg

At this time, enter ffmpeg in the terminal to get:

❯ ffmpeg
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0-with-options_2 --enable-shared --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libaom --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-demuxer=dash --enable-opencl --enable-videotoolbox --enable-neon --disable-htmlpages
  libavutil      57. 17.100/57. 17.100
  libavcodec     59. 18.100/59. 18.100
  libavformat    59. 16.100/59. 16.100
  libavdevice    59.  4.100/59.  4.100
  libavfilter     8. 24.100/ 8. 24.100
  libswscale      6.  4.100/ 6.  4.100
  libswresample   4.  3.100/ 4.  3.100
  libpostproc    56.  3.100/56.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

[Solved] New MAC Unity Develop Error: error installing cocoapods

The new MAC system is 11.4, and the installed Xcode version is 13.2.1
after opening a unity project and switching to IOS platform, cocoapods is installed in the background, but an error is reported indicating that the installation fails:

ERROR: Error installing cocoapods:
       ERROR: Failed to build gem native extension.
   current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Framewoks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220311-4106-wxounc.rb extconf.rb
   mkmf.rb can't find header files for ruby at /System/Library/Framewoks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development environment,ruby-dev or ruby-devel for example.

According to the error prompt and query from the network, it should be that a new Ruby Version needs to be installed, and the ruby provided by the system cannot be used
installing Ruby requires RVM, and installing RVM requires homebrew

Install homebrew

Use the command /usr/bin/Ruby - e" $(curl - fssl) is not used here https://raw.githubusercontent.com/Homebrew/install/master/install )"

After installation, execute brew update update.

Then execute brew -vto see the installed version

Install RVM

Install RVM curl -L https://get.rvm.io | bash -s stable

reload RVM environment source ~/.rvm/scripts/rvm

View RVM version RVM -v

Install Ruby

Check the known version of ruby RVM list known

check the installed version of ruby RVM list

Install a ruby version. I chose 2.6.5 RVM install 2.6.5

After installation, check the Ruby Version Ruby -v. If it is not the version just downloaded, I need to use the command to cut the version

Install cocoapods

After the above installation, execute sudo gem install cocoapods -n/usr/local/bin to install cocoapods
after the installation, execute pod --version to view the version of cocoapods

Here, for unit packaging, cocoapods are not completely installed. You need to continue to follow the following steps.

Command + Shift + G, open to the folderpop-up window, and enter ~/.cocoapods, after opening the cocoapods folder, delete all the contents under it, create a new repos folder, open the command line tool, and execute the following three commands in turn

1) cd ~/.cocoapods/repos
2) git clone --depth 1 https://github.com/CocoaPods/Specs.git master
3) pod repo update

In this way, the Xcode project exported by unity will have Xcworkspace file (in case of problems in cocoapods environment, the exported Xcode project only has .xcodeproj file, and there are many exceptions when using this file for packaging press conference), and then open the file with Xcode for subsequent publishing

[Solved] MacOS Compile ffmpeg Error: ERROR: openssl not found

On a whim today, I suddenly want to start studying the source code of ffmpeg. After downloading all the dependent libraries, I use the command configure

sh configure --prefix=/usr/local/ffmpeg \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-postproc \
--enable-libass \
--disable-libcelt \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libopenjpeg \
--enable-openssl \
--enable-libopus \
--enable-libspeex \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libxvid \
--disable-static \
--disable-x86asm \
--enable-shared

appear. Error: an error is reported when OpenSSL is not found. The version of OpenSSL I use is

Then the solution is seen from here

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

After writing, configure succeeded!

If you encounter some other problems, such as the following, you only need to delete the corresponding file and reconfigure it

config.h is unchanged
libavutil/avconfig.h is unchanged
libavfilter/filter_list.c is unchanged
libavcodec/codec_list.c is unchanged
libavcodec/parser_list.c is unchanged
libavcodec/bsf_list.c is unchanged
libavformat/demuxer_list.c is unchanged
libavformat/muxer_list.c is unchanged
libavdevice/indev_list.c is unchanged
libavdevice/outdev_list.c is unchanged
libavformat/protocol_list.c is unchanged
ffbuild/config.sh is unchanged