Error while using bench new-site library.test

While running the bench new-site library.test I got an error

bench new-site library.test
MySQL root password: 
Traceback (most recent call last):
  File "/Users/devendra/.pyenv/versions/3.8.0/lib/python3.8/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/devendra/.pyenv/versions/3.8.0/lib/python3.8/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 104, in <module>
    main()
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/commands/site.py", line 38, in new_site
    _new_site(db_name, site, mariadb_root_username=mariadb_root_username,
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/installer.py", line 62, in _new_site
    install_db(
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/installer.py", line 109, in install_db
    setup_database(force, source_sql, verbose, no_mariadb_socket)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/database/__init__.py", line 16, in setup_database
    return frappe.database.mariadb.setup_db.setup_database(force, source_sql, verbose, no_mariadb_socket=no_mariadb_socket)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/database/mariadb/setup_db.py", line 41, in setup_database
    if force or (db_name not in dbman.get_database_list()):
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/database/db_manager.py", line 60, in get_database_list
    return [d[0] for d in self.db.sql("SHOW DATABASES")]
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/apps/frappe/frappe/database/database.py", line 157, in sql
    self._cursor.execute(query)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/Users/devendra/PycharmProjects/frappe-projects/frappe-bench/env/lib/python3.8/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1018, 'Can\'t read dir of \'.\' (errno: 24 "Too many open files")')

I am using MacOS (10.15.7), node 14.18.3, python 3.8, mariadb 10.6.4

I tried the solution mentioned in Issue but got an error sysctl: illegal option -- p

Would appreciate any help to resolve this issue!