Giter Site home page Giter Site logo

launchk's Introduction

launchk

Rust

A Cursive TUI that makes XPC queries & helps manage launchd jobs.

Should work on macOS 10.10+ according to the availability sec. in the docs.

Install

Binaries are available via brew tap:

brew tap mach-kernel/pkgs
brew install mach-kernel/pkgs/launchk

Features

Use : to enter command mode, / to enter filtering mode, and any of sguadl for filtering by [system, global, user, agent, daemon, loaded]. Ctrl-U to clear, Tab to complete, Enter to submit.

  • Poll XPC for jobs and display changes as they happen
  • Filter by LaunchAgents and LaunchDaemons in scopes (fsnotify watched):
    • System (/System/Library/)
    • Global (/Library)
    • User (~/)
  • load
  • unload
  • dumpstate (opens in $PAGER)
  • dumpjpcategory (opens in $PAGER)
  • procinfo (opens in $PAGER, does not require root!)
  • edit plist in $EDITOR with support for binary plists
  • csrinfo show all CSR flags and their values

xpc-sys

While building launchk, XPC convenience glue was placed in xpc-sys.

[See its README here]

Credits

A big thanks to these open source projects and general resources:

Everything else (C) David Stancu & Contributors 2021

launchk's People

Contributors

hjmallon avatar mach-kernel avatar szabgab avatar timsutton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

launchk's Issues

Compiling on M1 arch Mac...

Hello, nice project - there is an issue w/ building on my M1 mac.

$ RUST_BACKTRACE=full cargo build
   Compiling xpc-sys v0.1.0 (/Users/dillera/code/launchk/xpc-sys)
error: failed to run custom build command for `xpc-sys v0.1.0 (/Users/dillera/code/launchk/xpc-sys)`

Caused by:
  process didn't exit successfully: `/Users/dillera/code/launchk/target/debug/build/xpc-sys-01feba28ada025d9/build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at 'libclang error; possible causes include:
  - Invalid flag syntax
  - Unrecognized flags
  - Invalid flag arguments
  - File I/O errors
  - Host vs. target architecture mismatch
  If you encounter an error missing from this list, please file an issue or a PR!', /Users/dillera/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.53.3/src/ir/context.rs:573:15
  stack backtrace:
     0:        0x100c0c614 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5b35424d98a84d2e
     1:        0x100c36ad0 - core::fmt::write::h66f440bd230d5049
     2:        0x100c0676c - std::io::Write::write_fmt::h5f96133b528343e9
     3:        0x100c1a898 - std::panicking::default_hook::{{closure}}::h30a27193d23180ec
     4:        0x100c1a5ec - std::panicking::default_hook::h200a4c4ea2ec4037
     5:        0x100c1ad4c - std::panicking::rust_panic_with_hook::hf19f16435a47814d
     6:        0x100c0cad0 - std::panicking::begin_panic_handler::{{closure}}::h7d30afed417a766c
     7:        0x100c0c754 - std::sys_common::backtrace::__rust_end_short_backtrace::hafb39ae92d7ecfa2
     8:        0x100c1a988 - _rust_begin_unwind
     9:        0x100c3cef8 - core::panicking::panic_fmt::h266736c2dfe1041a
    10:        0x100c3cad4 - core::option::expect_failed::h08b745f41456567e
    11:        0x10090cf14 - core::option::Option<T>::expect::h57c56808794faea3
                                 at /private/tmp/rust-20210109-48369-1kpc7mp/rustc-1.49.0-src/library/core/src/option.rs:349:21
    12:        0x1007f63a0 - bindgen::ir::context::BindgenContext::new::h1754a239b8c2388e
                                 at /Users/dillera/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.53.3/src/ir/context.rs:567:13
    13:        0x100918ea4 - bindgen::Bindings::generate::h7873b7760afa6090
                                 at /Users/dillera/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.53.3/src/lib.rs:2106:27
    14:        0x100916fe4 - bindgen::Builder::generate::h9e1dfbc29e69744c
                                 at /Users/dillera/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.53.3/src/lib.rs:1419:9
    15:        0x10079cb7c - build_script_build::main::h46e3bd2278cbf846
                                 at /Users/dillera/code/launchk/xpc-sys/build.rs:23:20
    16:        0x10079c340 - core::ops::function::FnOnce::call_once::h2436943b26989654
                                 at /private/tmp/rust-20210109-48369-1kpc7mp/rustc-1.49.0-src/library/core/src/ops/function.rs:227:5
    17:        0x10079bc44 - std::sys_common::backtrace::__rust_begin_short_backtrace::haf465ac0d2257dae
                                 at /private/tmp/rust-20210109-48369-1kpc7mp/rustc-1.49.0-src/library/std/src/sys_common/backtrace.rs:125:18
    18:        0x10079b470 - std::rt::lang_start::{{closure}}::h6fd6a33a0130abc8
                                 at /private/tmp/rust-20210109-48369-1kpc7mp/rustc-1.49.0-src/library/std/src/rt.rs:66:18
    19:        0x100c1f17c - std::rt::lang_start_internal::h5a4531374b5aaa0d
    20:        0x10079b448 - std::rt::lang_start::h6ae75154879f8b6a
                                 at /private/tmp/rust-20210109-48369-1kpc7mp/rustc-1.49.0-src/library/std/src/rt.rs:65:5
    21:        0x10079cdf4 - _main

$ llvm-config --version
11.1.0

MacBookAir10,1 with the Apple M1 chip

MacOS 11.2.1.

$ clang --version clang version 11.1.0 Target: arm64-apple-darwin20.3.0 Thread model: posix InstalledDir: /opt/homebrew/opt/llvm/bin

XPCObject::default() crashes on drop

let a = XPCObject::default();

Add that to a test and I get (signal: 11, SIGSEGV: invalid memory reference). xpc_release cannot be called on nullptr.

Incorrect handling of unload for LaunchDaemons

To reproduce:

  • Start launchk as non-root user
  • Find a */Daemon service (org.cups.cupsd is a good one)
  • Try to unload it (or do anything)

It will silently fail. Same as doing this, which is wrong:

$ launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
Warning: Expecting a LaunchAgents path since the command was ran as user. Got LaunchDaemons instead.
`launchctl bootout` is a recommended alternative.
Unload failed: 5: Input/output error
Try running `launchctl bootout` as root for richer errors.

QueryBuilder in xpc-sys?

I ran across the xps-sys library, which looks like it's exactly what I need for a project that talks to launchd. However, the xpc-sys library references a QueryBuilder trait, which doesn't seem to exist within the xpc-sys crate, but instead in the launchk crate. Should the QueryBuilder trait get moved into the xpc-sys crate so that it's available for use to xpc-sys consumers?

xpc-sys fails to build

I'm on an M1 mac, not sure if that matters, I made the change in #4 without success.

$ rustc --version
rustc 1.71.0 (8ede3aae2 2023-07-12)c
$ cargo build
   Compiling xpc-sys v0.4.0 (/Users/n8henrie/git/launchk/xpc-sys)
warning: unused doc comment
  --> xpc-sys/src/lib.rs:26:1
   |
26 | / /// Some extra private API definitions. Thanks:
27 | | ///
28 | | /// https://developer.apple.com/documentation/kernel/mach
29 | | /// https://chromium.googlesource.com/chromium/src.git/+/47.0.2507.2/sandbox/mac/xpc_private_stubs.sig
   | |______________________________________________________________________________________________________^
30 | / extern "C" {
31 | |     // Can decode i64 returned in "errors" for XPC responses
32 | |     pub fn xpc_strerror(err: c_int) -> *const c_char;
33 | |     pub static errno: c_int;
...  |
60 | |     pub static _os_alloc_once_table: [_os_alloc_once_s; 10];
61 | | }
   | |_- rustdoc does not generate documentation for extern blocks
   |
   = help: use `//` for a plain comment
   = note: `#[warn(unused_doc_comments)]` on by default

error[E0507]: cannot move out of `self.content` which is behind a shared reference
     --> /Users/n8henrie/git/launchk/target/debug/build/xpc-sys-6218adb712f8e8d0/out/bindings.rs:19279:5
      |
19273 | #[derive(Debug)]
      |          ----- in this derive macro expansion
...
19279 |     pub content: __IncompleteArrayField<u8>,
      |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move occurs because `self.content` has type `__IncompleteArrayField<u8>`, which does not implement the `Copy` trait
      |
      = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0507`.
warning: `xpc-sys` (lib) generated 1 warning
error: could not compile `xpc-sys` (lib) due to previous error; 1 warning emitted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.